Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
111571f4c1 | ||
|
|
529eef3e7e | ||
|
|
527e8129ba | ||
|
|
4e7b51c334 | ||
|
|
03d6870c64 | ||
|
|
dd50871cf6 | ||
|
|
bcc609179e | ||
|
|
ddcf224029 | ||
|
|
beeb5c4228 | ||
|
|
03bb6b4197 | ||
|
|
54e23b3aa5 | ||
|
|
054dd25079 | ||
|
|
974690132e | ||
|
|
d67a2569f4 | ||
|
|
fefcef4021 |
No files matched your search
@@ -0,0 +1,272 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
schedule:
|
||||
- cron: "0 6 * * 1"
|
||||
|
||||
jobs:
|
||||
build-and-scan:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
|
||||
- name: Scan for secrets
|
||||
run: |
|
||||
# docker cp, not a build COPY: a repo's own .dockerignore would otherwise
|
||||
# silently give an empty, falsely-clean scan.
|
||||
CID=$(docker create zricethezav/gitleaks:v8.30.1 detect --source=/repo --no-banner -v)
|
||||
docker cp . "$CID:/repo"
|
||||
docker start -a "$CID"
|
||||
STATUS=$?
|
||||
docker rm "$CID" > /dev/null
|
||||
exit $STATUS
|
||||
|
||||
- name: Lint Dockerfile with hadolint
|
||||
run: docker run --rm -i hadolint/hadolint:v2.15.1-alpine hadolint --failure-threshold error - < docker/Dockerfile
|
||||
|
||||
- name: Build Docker image
|
||||
run: |
|
||||
docker build -f docker/Dockerfile -t instameex:ci . 2>&1 | tee build.log
|
||||
if grep -q "Building wheel for" build.log; then
|
||||
echo "::warning::A dependency was built from source — check Python/Alpine compatibility"
|
||||
fi
|
||||
|
||||
- name: Smoke test (syntax + binaries)
|
||||
run: |
|
||||
docker run --rm --entrypoint python instameex:ci -m compileall -q /app/main.py /app/src
|
||||
docker run --rm --entrypoint sh instameex:ci -c "test -x /usr/local/bin/ultrahdr_app && exiftool -ver"
|
||||
|
||||
- name: Run unit tests
|
||||
run: |
|
||||
docker build -f docker/Dockerfile --target test -t instameex:test .
|
||||
docker run --rm instameex:test pytest -v --cov=src --cov-report=term-missing --cov-fail-under=75
|
||||
|
||||
- name: Lint with ruff
|
||||
run: docker build -f docker/Dockerfile --target lint -t instameex:lint .
|
||||
|
||||
- name: Check deprecation warnings
|
||||
run: |
|
||||
docker run --rm --entrypoint python instameex:ci -W error::DeprecationWarning -c "import main" 2>&1 | tee deprecation.log || true
|
||||
if grep -qi "deprecat" deprecation.log; then
|
||||
echo "::warning::Deprecation warning detected, check logs"
|
||||
fi
|
||||
|
||||
- name: Scan with Trivy (critical - blocking)
|
||||
id: trivy_critical
|
||||
continue-on-error: true
|
||||
run: |
|
||||
docker run --rm \
|
||||
-e DOCKER_HOST=tcp://dockerhost:2375 \
|
||||
--add-host=dockerhost:host-gateway \
|
||||
aquasec/trivy:0.74.0 image --exit-code 1 --severity CRITICAL instameex:ci
|
||||
|
||||
- name: Handle CRITICAL findings
|
||||
if: steps.trivy_critical.outcome == 'failure'
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" != "schedule" ]; then
|
||||
echo "::error::CRITICAL vulnerabilities found, failing the build."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Scheduled scan found CRITICAL vulnerabilities — attempting an automatic apk upgrade + rescan."
|
||||
|
||||
# Add an apk upgrade right after the base stage's FROM
|
||||
sed -i '/^FROM python:.* AS base$/a RUN apk upgrade --no-cache' docker/Dockerfile
|
||||
docker build -f docker/Dockerfile -t instameex:remediated .
|
||||
|
||||
if docker run --rm \
|
||||
-e DOCKER_HOST=tcp://dockerhost:2375 \
|
||||
--add-host=dockerhost:host-gateway \
|
||||
aquasec/trivy:0.74.0 image --exit-code 1 --severity CRITICAL instameex:remediated; then
|
||||
echo "apk upgrade clears the CRITICAL finding(s) — opening a PR for review."
|
||||
|
||||
BRANCH="auto/cve-fix-$(date +%Y%m%d)-$(echo "${{ github.sha }}" | cut -c1-7)"
|
||||
git config user.name "instameex-ci"
|
||||
git config user.email "[email protected]"
|
||||
git checkout -b "$BRANCH"
|
||||
git add docker/Dockerfile
|
||||
git commit -m "Auto-remediate CRITICAL CVE via apk upgrade"
|
||||
git config --unset-all http.https://git.djeex.fr/.extraheader || true
|
||||
git push "https://Djeex:${{ secrets.CI_PUSH_TOKEN }}@git.djeex.fr/Djeex/instameex.git" "HEAD:$BRANCH"
|
||||
|
||||
PR_JSON=$(curl -s -X POST \
|
||||
-H "Authorization: token ${{ secrets.CI_PUSH_TOKEN }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$(jq -n --arg head "$BRANCH" '{title: "🔒 Auto: remediate CRITICAL CVE via apk upgrade", head: $head, base: "main", body: "Opened automatically by the scheduled CVE scan. An `apk upgrade --no-cache` cleared the CRITICAL Trivy finding(s) in a rebuild — review the diff and merge to publish the fix."}')" \
|
||||
"https://git.djeex.fr/api/v1/repos/Djeex/instameex/pulls")
|
||||
echo "PR API response: $(echo "$PR_JSON" | jq -r '.html_url // .message // "unknown"')"
|
||||
else
|
||||
echo "::error::apk upgrade does not clear the CRITICAL finding(s) — no automatic fix available, needs manual review."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Scan with Trivy (high - informative)
|
||||
run: |
|
||||
docker run --rm \
|
||||
-e DOCKER_HOST=tcp://dockerhost:2375 \
|
||||
--add-host=dockerhost:host-gateway \
|
||||
aquasec/trivy:0.74.0 image --exit-code 0 --severity HIGH instameex:ci
|
||||
|
||||
- name: Publish tagged image
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
run: |
|
||||
BEFORE="${{ github.event.before }}"
|
||||
if [ -n "$BEFORE" ] && [ "$BEFORE" != "0000000000000000000000000000000000000000" ] && git cat-file -e "$BEFORE" 2>/dev/null; then
|
||||
BASE_REF="$BEFORE"
|
||||
else
|
||||
BASE_REF="HEAD~1"
|
||||
fi
|
||||
CHANGED=$(git diff --name-only "$BASE_REF" "${{ github.sha }}")
|
||||
echo "Changed files:"
|
||||
echo "$CHANGED"
|
||||
|
||||
if ! echo "$CHANGED" | grep -qE '^(VERSION|main\.py|requirements\.txt)$|^(docker|src)/'; then
|
||||
echo "No container-relevant file changed, skipping publish."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if echo "$CHANGED" | grep -qE '^VERSION$'; then
|
||||
echo "VERSION was manually edited in this push, using it as-is."
|
||||
else
|
||||
echo "VERSION untouched but container files changed, auto-bumping the build number (Z)."
|
||||
OLD_VERSION=$(tr -d '[:space:]' < VERSION)
|
||||
IFS='.' read -r MAJOR MINOR PATCH <<< "$OLD_VERSION"
|
||||
NEW_VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))"
|
||||
echo "$NEW_VERSION" > VERSION
|
||||
|
||||
git config user.name "instameex-ci"
|
||||
git config user.email "[email protected]"
|
||||
git add VERSION
|
||||
git commit -m "Bump build version to $NEW_VERSION [skip ci]"
|
||||
|
||||
git config --unset-all http.https://git.djeex.fr/.extraheader || true
|
||||
|
||||
git push "https://Djeex:${{ secrets.CI_PUSH_TOKEN }}@git.djeex.fr/Djeex/instameex.git" HEAD:main
|
||||
fi
|
||||
|
||||
VERSION=$(tr -d '[:space:]' < VERSION)
|
||||
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
|
||||
MINOR_TAG="${MAJOR}.${MINOR}"
|
||||
|
||||
IMAGE=git.djeex.fr/djeex/instameex
|
||||
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login git.djeex.fr -u Djeex --password-stdin
|
||||
|
||||
# Retag the already-built, already-scanned image — never rebuild for publish,
|
||||
# so what ships is byte-for-byte what Trivy just scanned.
|
||||
docker tag instameex:ci "$IMAGE:latest"
|
||||
docker tag instameex:ci "$IMAGE:$MINOR_TAG"
|
||||
docker tag instameex:ci "$IMAGE:$VERSION"
|
||||
docker push "$IMAGE:latest"
|
||||
docker push "$IMAGE:$MINOR_TAG"
|
||||
docker push "$IMAGE:$VERSION"
|
||||
|
||||
GHCR_IMAGE=ghcr.io/djeex/instameex
|
||||
echo "${{ secrets.GH_TOKEN }}" | docker login ghcr.io -u Djeex --password-stdin
|
||||
|
||||
docker tag instameex:ci "$GHCR_IMAGE:latest"
|
||||
docker tag instameex:ci "$GHCR_IMAGE:$MINOR_TAG"
|
||||
docker tag instameex:ci "$GHCR_IMAGE:$VERSION"
|
||||
docker push "$GHCR_IMAGE:latest"
|
||||
docker push "$GHCR_IMAGE:$MINOR_TAG"
|
||||
docker push "$GHCR_IMAGE:$VERSION"
|
||||
|
||||
TRIGGER_MSG=$(git log -1 --format=%s "${{ github.sha }}")
|
||||
PR_NUM=$(echo "$TRIGGER_MSG" | grep -oE '#[0-9]+' | head -1 | tr -d '#' || true)
|
||||
|
||||
CATEGORY="🔧 Maintenance"
|
||||
CHANGE_TITLE="$TRIGGER_MSG"
|
||||
|
||||
if [ -n "$PR_NUM" ]; then
|
||||
PR_JSON=$(curl -s -H "Authorization: token ${{ secrets.CI_PUSH_TOKEN }}" \
|
||||
"https://git.djeex.fr/api/v1/repos/Djeex/instameex/pulls/$PR_NUM")
|
||||
PR_TITLE=$(echo "$PR_JSON" | jq -r '.title // empty' 2>/dev/null || true)
|
||||
LABELS=$(echo "$PR_JSON" | jq -r '.labels[]?.name' 2>/dev/null || true)
|
||||
|
||||
if [ -n "$PR_TITLE" ]; then
|
||||
CHANGE_TITLE="$PR_TITLE"
|
||||
fi
|
||||
|
||||
if echo "$LABELS" | grep -qx 'bug'; then
|
||||
CATEGORY="⚠️ Hotfix"
|
||||
elif echo "$LABELS" | grep -qx 'major'; then
|
||||
CATEGORY="💥 Breaking change"
|
||||
elif echo "$LABELS" | grep -qx 'minor'; then
|
||||
CATEGORY="✨ Update"
|
||||
fi
|
||||
fi
|
||||
|
||||
REPO_URL="https://git.djeex.fr/Djeex/instameex"
|
||||
COMMIT_LIST=$(git log --no-merges --format="- %s ([%h](${REPO_URL}/commit/%H))" "$BASE_REF".."${{ github.sha }}")
|
||||
|
||||
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
|
||||
SOURCE_LINE="[${SHORT_SHA}](${REPO_URL}/commit/${{ github.sha }})"
|
||||
if [ -n "$PR_NUM" ]; then
|
||||
SOURCE_LINE="[#${PR_NUM}](${REPO_URL}/pulls/${PR_NUM}) · ${SOURCE_LINE}"
|
||||
fi
|
||||
|
||||
NOTE_BANNER=$(printf '> [!NOTE]\n>⚠️ _This is an heavily vibe-coded proof of concept — do not expose it to the internet — use it at your own risk._')
|
||||
|
||||
BODY=$(cat <<EOF
|
||||
${NOTE_BANNER}
|
||||
|
||||
## Changelog
|
||||
|
||||
### ${CATEGORY}
|
||||
${CHANGE_TITLE}
|
||||
|
||||
**Source:** ${SOURCE_LINE}
|
||||
**Image:** \`${IMAGE}:${VERSION}\`
|
||||
|
||||
**Commits:**
|
||||
${COMMIT_LIST}
|
||||
EOF
|
||||
)
|
||||
|
||||
JSON_PAYLOAD=$(jq -n \
|
||||
--arg tag "v$VERSION" \
|
||||
--arg name "v$VERSION" \
|
||||
--arg body "$BODY" \
|
||||
'{tag_name: $tag, name: $name, target_commitish: "main", body: $body}')
|
||||
|
||||
curl -s -o /dev/null -w "Release API response: %{http_code}\n" -X POST \
|
||||
-H "Authorization: token ${{ secrets.CI_PUSH_TOKEN }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$JSON_PAYLOAD" \
|
||||
"https://git.djeex.fr/api/v1/repos/Djeex/instameex/releases"
|
||||
|
||||
MIRROR_NOTICE="_This github repo is a mirror of https://git.djeex.fr/Djeex/instameex. You'll find full package, PR, history and release note there._"
|
||||
GH_BODY=$(printf '%s\n\n%s' "$MIRROR_NOTICE" "$BODY")
|
||||
|
||||
GH_JSON_PAYLOAD=$(jq -n \
|
||||
--arg tag "v$VERSION" \
|
||||
--arg name "v$VERSION" \
|
||||
--arg body "$GH_BODY" \
|
||||
--arg sha "${{ github.sha }}" \
|
||||
'{tag_name: $tag, name: $name, target_commitish: $sha, body: $body}')
|
||||
|
||||
GH_STATUS=0
|
||||
for i in 1 2 3 4 5; do
|
||||
GH_STATUS=$(curl -s -o /tmp/gh_release.json -w "%{http_code}" -X POST \
|
||||
-H "Authorization: Bearer ${{ secrets.GH_TOKEN }}" \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$GH_JSON_PAYLOAD" \
|
||||
"https://api.github.com/repos/Djeex/instameex/releases")
|
||||
if [ "$GH_STATUS" = "201" ]; then
|
||||
break
|
||||
fi
|
||||
echo "GitHub Release attempt $i failed (HTTP $GH_STATUS) — mirror may not have synced this commit yet, retrying in 15s..."
|
||||
sleep 15
|
||||
done
|
||||
echo "GitHub Release API response: $GH_STATUS"
|
||||
if [ "$GH_STATUS" != "201" ]; then
|
||||
cat /tmp/gh_release.json 2>/dev/null || true
|
||||
fi
|
||||
@@ -1,27 +1,54 @@
|
||||
|
||||
<div align="center">
|
||||
<img src="src/assets/img/logo-long.svg" alt="Instameex logo" width="400"/>
|
||||
</div>
|
||||
<p/>
|
||||
<div align="center">
|
||||
<p>Mix your SDR and HDR exports into an Instagram-ready HDR photo.</p>
|
||||
</div>
|
||||
</p>
|
||||
<div align="center">
|
||||
<img src="illustration/instameex-illustration.png" alt="Instameex screenshot" width="640"/>
|
||||
</div>
|
||||
|
||||
|
||||
> [!NOTE]
|
||||
> ⚠️ _This is an heavily vibe-coded proof of concept — **do not expose it to the internet** — use it at your own risk._
|
||||
> _Github repo is a mirror of https://git.djeex.fr/Djeex/insta-hdr-converter. You'll find full package, history and release note there._
|
||||
> _Github repo is a mirror of https://git.djeex.fr/Djeex/instameex. You'll find full package, history and release note there._
|
||||
|
||||
# Instagram HDR Assembler
|
||||
# Instameex
|
||||
|
||||
A small web front end for assembling Instagram-compatible HDR JPEGs (gain
|
||||
map) from an SDR export and an HDR export out of Lightroom or Camera Raw.
|
||||
|
||||
The gain-map assembly logic ([app/assembler.py](app/assembler.py)) is
|
||||
Check the online version : [Instameex-web](https://instameex.djeex.fr/)
|
||||
|
||||
The gain-map assembly logic ([src/script/app/assembler.py](src/script/app/assembler.py)) is
|
||||
adapted from [kostis-kounadis/instagram-hdr-assembler](https://github.com/kostis-kounadis/instagram-hdr-assembler),
|
||||
itself based on the reverse-engineering work of
|
||||
[karachungen/instagram-hdr-converter](https://github.com/karachungen/instagram-hdr-converter).
|
||||
Original MIT license kept in [LICENSE](LICENSE).
|
||||
|
||||
Only the upstream's Method 2 (starting from an HDR JPEG that already
|
||||
carries a gain map) is implemented here. Method 1's AVIF decoding and
|
||||
its quality/transfer/gamut settings were dropped, but the HDR side can
|
||||
still be a 32-bit float linear TIFF (Lightroom's HDR TIFF export)
|
||||
instead of a gain-map JPEG for a more precise result. Either way the
|
||||
gain map is recomputed rather than reused as-is (see below), since it
|
||||
needs to be correct against the SDR file you actually provide.
|
||||
## Contents
|
||||
|
||||

|
||||
- [Why?](#why)
|
||||
- [How it works](#how-it-works)
|
||||
- [Running locally, without Docker](#running-locally-without-docker)
|
||||
- [Running with Docker](#running-with-docker)
|
||||
- [Running this on the open internet](#running-this-on-the-open-internet)
|
||||
|
||||
## Why ?
|
||||
|
||||
Nothing is more frustrating than Instagram's HDR handling. It compresses and destroys gain maps, and the slightest change in aspect ratio or size simply strips HDR out entirely. As for Lightroom, its "SDR preview" system is frankly unacceptable, it makes it impossible to get consistent results. Until now, posting on Instagram meant choosing between decent SDR with broken HDR, or the other way around.
|
||||
|
||||
Why not simply edit your SDR file to perfection on one side, your HDR file on the other, and then recalculate a gain map from those two perfect files?
|
||||
A few pioneers have already gone down that road, notably with an [Adobe Lightroom Classic](https://github.com/karachungen/lightroom-plugin-export-hdr) plugin. Judge me if you want, but I only use Lightroom CC, which does not support plugins.
|
||||
|
||||
I drew inspiration from a [fork of the original project](https://github.com/kostis-kounadis/instagram-hdr-assembler), the one that eventually became the LrC plugin, to build a frontend that can be easily deployed with Docker. Let's be honest: it was also a great excuse to put my Claude Code subscription to the test. And I have to say, watching it spin up its own environments, run end-to-end tests, self-correct its code, and write detailed summaries is genuinely impressive. I still reviewed everything myself, don't worry. I also learned a great deal about HDR fundamentals, gain maps, HLG/PQ tone curves, color spaces, and more.
|
||||
|
||||
In short, here is what my workflow now looks like for posting on Instagram:
|
||||
|
||||

|
||||
|
||||
## How it works
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ RUN cmake -G "Unix Makefiles" -DUHDR_WRITE_XMP=ON \
|
||||
&& cmake --build libultrahdr/build -j"$(nproc)"
|
||||
|
||||
# ---- Stage 2: runtime -------------------------------------------------------
|
||||
FROM python:3.11-alpine
|
||||
FROM python:3.11-alpine AS base
|
||||
|
||||
RUN apk add --no-cache exiftool libjpeg-turbo libstdc++
|
||||
|
||||
@@ -27,13 +27,27 @@ COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY main.py .
|
||||
COPY app/ app/
|
||||
COPY templates/ templates/
|
||||
COPY static/ static/
|
||||
COPY src/ src/
|
||||
COPY LICENSE VERSION ./
|
||||
COPY docker/entrypoint.sh /app/entrypoint.sh
|
||||
RUN chmod +x /app/entrypoint.sh
|
||||
|
||||
FROM base AS test
|
||||
|
||||
RUN pip install --no-cache-dir pytest==9.1.1 pytest-cov==7.1.0
|
||||
COPY pytest.ini ./
|
||||
COPY tests/ tests/
|
||||
CMD ["pytest", "-v"]
|
||||
|
||||
FROM base AS lint
|
||||
|
||||
RUN pip install --no-cache-dir ruff==0.16.4
|
||||
COPY ruff.toml ./
|
||||
COPY tests/ tests/
|
||||
RUN ruff check .
|
||||
|
||||
FROM base
|
||||
|
||||
RUN adduser -D runner && mkdir -p /app/jobs && chown -R runner:runner /app
|
||||
USER runner
|
||||
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
name: instagram-hdr
|
||||
name: instameex
|
||||
|
||||
services:
|
||||
hdr-web:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/Dockerfile
|
||||
container_name: instagram-hdr-web
|
||||
image: instameex
|
||||
container_name: instameex
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "5050:5000" # host:container — change 5050 if that's taken too
|
||||
# Put a reverse proxy (Traefik/nginx/SWAG) in front of this if you
|
||||
# want it reachable outside your LAN — the Flask app itself has no
|
||||
# auth and no rate limiting, so keep it internal-only or add both
|
||||
# before exposing it further than your own network.
|
||||
@@ -6,13 +6,12 @@ NC="\033[0m"
|
||||
|
||||
VERSION=$(cat /app/VERSION)
|
||||
|
||||
echo -e "${CYAN}╭──────────────────────────────────────────────────╮${NC}"
|
||||
echo -e "${CYAN}│${NC} Instagram ${CYAN}HDR${NC} Assembler — version ${VERSION} ${CYAN}│${NC}"
|
||||
echo -e "${CYAN}├──────────────────────────────────────────────────┤${NC}"
|
||||
echo -e "${CYAN}│${NC} License: MIT (see LICENSE) ${CYAN}│${NC}"
|
||||
echo -e "${CYAN}│${NC} Gain-map pipeline adapted from: ${CYAN}│${NC}"
|
||||
echo -e "${CYAN}│${NC} kostis-kounadis/instagram-hdr-assembler ${CYAN}│${NC}"
|
||||
echo -e "${CYAN}╰──────────────────────────────────────────────────╯${NC}"
|
||||
echo -e "${CYAN}╭──────────────────────────────────────────────╮${NC}"
|
||||
echo -e "${CYAN}│${NC} Instam${CYAN}eex${NC} - Version ${VERSION} ${CYAN}│${NC}"
|
||||
echo -e "${CYAN}├──────────────────────────────────────────────┤${NC}"
|
||||
echo -e "${CYAN}│${NC} Source: https://git.djeex.fr/Djeex/instameex ${CYAN}│${NC}"
|
||||
echo -e "${CYAN}│${NC} Mirror: https://github.com/Djeex/instameex ${CYAN}│${NC}"
|
||||
echo -e "${CYAN}╰──────────────────────────────────────────────╯${NC}"
|
||||
|
||||
echo -e "[~] Checking required external tools..."
|
||||
missing=""
|
||||
@@ -27,5 +26,5 @@ if [ -n "$missing" ]; then
|
||||
fi
|
||||
echo -e "[✓] Required tools found: ultrahdr_app, exiftool"
|
||||
|
||||
echo -e "[~] Starting Instagram HDR Assembler web server..."
|
||||
echo -e "[~] Starting Instameex web server..."
|
||||
exec gunicorn --bind 0.0.0.0:5000 --workers 1 --threads 4 --timeout 120 main:app
|
||||
|
After Width: | Height: | Size: 140 KiB |
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1473.7981439579798 1123.3987043300267" width="4421.3944318739395" height="3370.19611299008"><!-- svg-source:excalidraw --><metadata></metadata><defs><style class="style-fonts">
|
||||
@font-face { font-family: Excalifont; src: url(data:font/woff2;base64,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 truncated
|
||||
|
After Width: | Height: | Size: 242 KiB |
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Instagram HDR Assembler — Web Front
|
||||
Instameex - Web Front
|
||||
------------------------------------
|
||||
Flask front end for assembling Instagram-compliant HDR JPEGs (gain map
|
||||
injection adapted from kostis-kounadis/instagram-hdr-assembler — see
|
||||
@@ -8,18 +8,21 @@ LICENSE). Gives you a browser form instead of a terminal, and
|
||||
surfaces the assembly report (including the "GainMapMin is negative"
|
||||
warning) on a results page.
|
||||
|
||||
This file is just the entry point — see app/ for the app itself:
|
||||
app/config.py constants
|
||||
app/jobs.py in-memory job registry + heartbeat/reaper
|
||||
app/validation.py upload + Instagram resolution checks
|
||||
app/assembler.py gain-map assembly pipeline
|
||||
app/routes.py Flask routes
|
||||
This file is just the entry point — see src/script/app/ for the app itself:
|
||||
src/script/app/config.py constants
|
||||
src/script/app/jobs.py in-memory job registry + heartbeat/reaper
|
||||
src/script/app/validation.py upload + Instagram resolution checks
|
||||
src/script/app/assembler.py gain-map assembly pipeline
|
||||
src/script/app/routes.py Flask routes
|
||||
|
||||
Run directly: python3 main.py
|
||||
Run in Docker: see Dockerfile (gunicorn main:app)
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent / "src" / "script"))
|
||||
|
||||
from app import create_app
|
||||
from app.assembler import check_dependencies
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
[pytest]
|
||||
testpaths = tests
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||
"extends": ["config:recommended"],
|
||||
"timezone": "Europe/Paris",
|
||||
"labels": ["bot"],
|
||||
"vulnerabilityAlerts": {
|
||||
"addLabels": ["bug"]
|
||||
},
|
||||
"customManagers": [
|
||||
{
|
||||
"customType": "regex",
|
||||
"description": "Docker images pinned in CI 'docker run' / 'docker create' commands",
|
||||
"managerFilePatterns": ["/^\\.gitea/workflows/.+\\.ya?ml$/"],
|
||||
"matchStrings": [
|
||||
"(?<depName>(?:zricethezav/gitleaks|hadolint/hadolint|aquasec/trivy)):(?<currentValue>v?\\d+\\.\\d+\\.\\d+(?:-[a-z]+)?)"
|
||||
],
|
||||
"datasourceTemplate": "docker"
|
||||
}
|
||||
],
|
||||
"packageRules": [
|
||||
{
|
||||
"matchManagers": ["pip_requirements"],
|
||||
"matchUpdateTypes": ["patch", "minor"],
|
||||
"automerge": true
|
||||
},
|
||||
{
|
||||
"matchManagers": ["dockerfile"],
|
||||
"matchUpdateTypes": ["patch"],
|
||||
"automerge": true
|
||||
},
|
||||
{
|
||||
"matchUpdateTypes": ["major"],
|
||||
"addLabels": ["major"]
|
||||
},
|
||||
{
|
||||
"matchUpdateTypes": ["minor"],
|
||||
"addLabels": ["minor"]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
Flask==3.1.3
|
||||
gunicorn==23.0.0
|
||||
Pillow==11.1.0
|
||||
Pillow==13.0.0
|
||||
numpy==2.4.6
|
||||
tifffile==2026.3.3
|
||||
@@ -0,0 +1,12 @@
|
||||
line-length = 100
|
||||
|
||||
[lint]
|
||||
select = ["E", "F", "I", "UP", "B"]
|
||||
# E501: long lines are left alone. B905: zip() in routes.py is already
|
||||
# length-checked just before; not touching app logic here.
|
||||
ignore = ["E501", "B905"]
|
||||
|
||||
[lint.isort]
|
||||
# Pinned explicitly: auto-detection of first-party modules differs between the
|
||||
# host and the Docker lint stage, which would silently diverge import sorting.
|
||||
known-first-party = ["app", "main"]
|
||||
|
Before Width: | Height: | Size: 298 KiB |
@@ -1,17 +1,25 @@
|
||||
:root {
|
||||
--bg: #14161a;
|
||||
--surface: #1c1f25;
|
||||
--surface-raised: #242830;
|
||||
--border: #33373f;
|
||||
--text: #eef1f4;
|
||||
--text-muted: #8b93a0;
|
||||
--accent: #2dd4bf;
|
||||
--accent-dim: #2a8577;
|
||||
--ok: #7fa37a;
|
||||
--err: #c4604a;
|
||||
--serif: Charter, "Iowan Old Style", "Palatino Linotype", Georgia, ui-serif, serif;
|
||||
--bg: #111010;
|
||||
--surface: rgb(67 67 67 / 26%);
|
||||
--surface-raised: #1f2223;
|
||||
--surface-focus: #161616;
|
||||
--border: #2f2e2e80;
|
||||
--border-solid: #585858;
|
||||
--text: #fbfbfb;
|
||||
--text-muted: #9a9a9a;
|
||||
--placeholder: #585858;
|
||||
--accent: #55c3ec;
|
||||
--accent-start: #26c4ff;
|
||||
--accent-end: #016074;
|
||||
--accent-hover-start: #72d9ff;
|
||||
--accent-hover-end: #26657e;
|
||||
--gold: #ffc700;
|
||||
--ok: #049b3d;
|
||||
--ok-bright: #28c76f;
|
||||
--err: #dc3545;
|
||||
--err-dim: rgb(121 26 19);
|
||||
--mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
|
||||
--sans: -apple-system, "Segoe UI", system-ui, sans-serif;
|
||||
--sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
@@ -20,8 +28,6 @@ body {
|
||||
margin: 0;
|
||||
padding: 3rem 1.5rem 5rem;
|
||||
background: var(--bg);
|
||||
background-image:
|
||||
radial-gradient(ellipse 900px 500px at 50% -10%, rgba(45, 212, 191, 0.07), transparent);
|
||||
color: var(--text);
|
||||
font-family: var(--sans);
|
||||
line-height: 1.5;
|
||||
@@ -34,19 +40,28 @@ body {
|
||||
}
|
||||
|
||||
.eyebrow {
|
||||
font-family: var(--mono);
|
||||
font-size: 0.72rem;
|
||||
letter-spacing: 0.14em;
|
||||
font-family: var(--sans);
|
||||
font-size: 0.78rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
color: var(--accent);
|
||||
margin: 0 0 0.6rem;
|
||||
}
|
||||
|
||||
.logo {
|
||||
display: block;
|
||||
width: 290px;
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
margin: 0 0 1.5rem;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-family: var(--serif);
|
||||
font-weight: 500;
|
||||
font-size: 2.1rem;
|
||||
line-height: 1.15;
|
||||
font-family: var(--sans);
|
||||
font-weight: 600;
|
||||
font-size: 1.7rem;
|
||||
line-height: 1.2;
|
||||
margin: 0 0 0.5rem;
|
||||
color: var(--text);
|
||||
}
|
||||
@@ -54,14 +69,15 @@ h1 {
|
||||
.subtitle {
|
||||
color: var(--text-muted);
|
||||
font-size: 0.95rem;
|
||||
margin: 0 0 2.5rem;
|
||||
margin: 0 0 2rem;
|
||||
max-width: 46ch;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
padding: 1.75rem;
|
||||
}
|
||||
|
||||
@@ -91,32 +107,45 @@ form { display: block; }
|
||||
width: 1.5rem;
|
||||
height: 1.5rem;
|
||||
line-height: 1;
|
||||
border: 1px solid var(--border);
|
||||
border: 1px solid var(--border-solid);
|
||||
border-radius: 50%;
|
||||
background: var(--surface-raised);
|
||||
background: #2d2d2d;
|
||||
color: var(--text-muted);
|
||||
font-size: 1rem;
|
||||
cursor: pointer;
|
||||
z-index: 1;
|
||||
transition: background 0.2s ease, color 0.2s ease;
|
||||
}
|
||||
|
||||
.duo:first-child .remove-duo { display: none; }
|
||||
.remove-duo:hover { color: var(--err); border-color: var(--err); }
|
||||
.remove-duo:hover { background: var(--err-dim); color: var(--text); }
|
||||
|
||||
.add-duo {
|
||||
display: block;
|
||||
width: 100%;
|
||||
background: transparent;
|
||||
border: 1px dashed var(--border);
|
||||
color: var(--text-muted);
|
||||
border: 1px solid var(--border-solid);
|
||||
color: var(--text);
|
||||
padding: 0.6rem 1rem;
|
||||
border-radius: 7px;
|
||||
border-radius: 30px;
|
||||
font-size: 0.85rem;
|
||||
cursor: pointer;
|
||||
transition: border-color 0.15s ease, color 0.15s ease;
|
||||
transition: background 0.2s ease;
|
||||
}
|
||||
|
||||
.add-duo:hover { color: var(--text); border-color: var(--accent-dim); }
|
||||
.add-duo:hover { background: #2d2d2d; }
|
||||
|
||||
.checkbox-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
margin: 1rem 0;
|
||||
font-size: 0.85rem;
|
||||
color: var(--text-muted);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.checkbox-row input { cursor: pointer; accent-color: var(--accent); }
|
||||
|
||||
.dropzones {
|
||||
display: grid;
|
||||
@@ -131,7 +160,7 @@ form { display: block; }
|
||||
|
||||
.dropzone {
|
||||
position: relative;
|
||||
border: 1px dashed var(--border);
|
||||
border: 1px dashed var(--border-solid);
|
||||
border-radius: 8px;
|
||||
padding: 1.25rem 1rem;
|
||||
text-align: center;
|
||||
@@ -140,20 +169,21 @@ form { display: block; }
|
||||
}
|
||||
|
||||
.dropzone:has(input:focus-visible) {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 2px;
|
||||
border-color: var(--accent);
|
||||
background: var(--surface-focus);
|
||||
}
|
||||
|
||||
.dropzone.has-file {
|
||||
border-color: var(--accent-dim);
|
||||
border-style: solid;
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
.dropzone label.tag {
|
||||
.dropzone .tag {
|
||||
display: block;
|
||||
font-family: var(--mono);
|
||||
font-size: 0.68rem;
|
||||
letter-spacing: 0.1em;
|
||||
font-family: var(--sans);
|
||||
font-size: 0.72rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.05em;
|
||||
text-transform: uppercase;
|
||||
color: var(--accent);
|
||||
margin-bottom: 0.5rem;
|
||||
@@ -185,26 +215,27 @@ form { display: block; }
|
||||
button.run {
|
||||
width: 100%;
|
||||
margin-top: 1.5rem;
|
||||
background: var(--accent);
|
||||
color: #06211d;
|
||||
background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
|
||||
color: #fff;
|
||||
border: none;
|
||||
padding: 0.75rem 1rem;
|
||||
border-radius: 7px;
|
||||
padding: 0.8rem 1rem;
|
||||
border-radius: 30px;
|
||||
font-size: 0.95rem;
|
||||
font-weight: 600;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
transition: background 0.15s ease;
|
||||
box-shadow: 0 4px 16px rgba(38, 196, 255, 0.15);
|
||||
transition: background 0.2s ease;
|
||||
}
|
||||
|
||||
button.run:hover { background: #5eead4; }
|
||||
button.run:hover { background: linear-gradient(135deg, var(--accent-hover-start), var(--accent-hover-end)); }
|
||||
button.run:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
|
||||
|
||||
.error-banner {
|
||||
background: rgba(196, 96, 74, 0.12);
|
||||
border: 1px solid rgba(196, 96, 74, 0.4);
|
||||
color: #e2a795;
|
||||
background: rgba(220, 53, 69, 0.12);
|
||||
border: 1px solid rgba(220, 53, 69, 0.4);
|
||||
color: #f28b95;
|
||||
padding: 0.7rem 0.9rem;
|
||||
border-radius: 7px;
|
||||
border-radius: 8px;
|
||||
font-size: 0.85rem;
|
||||
margin-bottom: 1.25rem;
|
||||
}
|
||||
@@ -213,36 +244,36 @@ button.run:focus-visible { outline: 2px solid var(--text); outline-offset: 2px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
font-family: var(--mono);
|
||||
font-family: var(--sans);
|
||||
font-weight: 700;
|
||||
font-size: 0.8rem;
|
||||
letter-spacing: 0.05em;
|
||||
text-transform: uppercase;
|
||||
padding: 0.35rem 0.7rem;
|
||||
border-radius: 5px;
|
||||
letter-spacing: 0.02em;
|
||||
padding: 0.35rem 0.9rem;
|
||||
border-radius: 30px;
|
||||
margin-bottom: 1.25rem;
|
||||
}
|
||||
|
||||
.status.ok { background: rgba(127, 163, 122, 0.14); color: var(--ok); }
|
||||
.status.err { background: rgba(196, 96, 74, 0.14); color: var(--err); }
|
||||
.status.ok { background: rgba(4, 155, 61, 0.16); color: var(--ok-bright); }
|
||||
.status.err { background: rgba(220, 53, 69, 0.14); color: #f28b95; }
|
||||
|
||||
.warning-banner {
|
||||
background: rgba(45, 212, 191, 0.1);
|
||||
border: 1px solid rgba(45, 212, 191, 0.35);
|
||||
color: var(--accent);
|
||||
background: rgba(255, 199, 0, 0.1);
|
||||
border: 1px solid rgba(255, 199, 0, 0.35);
|
||||
color: var(--gold);
|
||||
padding: 0.7rem 0.9rem;
|
||||
border-radius: 7px;
|
||||
border-radius: 8px;
|
||||
font-size: 0.85rem;
|
||||
margin-bottom: 1.25rem;
|
||||
}
|
||||
|
||||
pre.log {
|
||||
background: #0e1015;
|
||||
background: #0a0a0a;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 7px;
|
||||
border-radius: 8px;
|
||||
padding: 1rem;
|
||||
font-family: var(--mono);
|
||||
font-size: 0.76rem;
|
||||
color: #b6c0c8;
|
||||
color: #c7c7c7;
|
||||
overflow-x: auto;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
@@ -261,24 +292,24 @@ pre.log {
|
||||
.btn-secondary {
|
||||
display: inline-block;
|
||||
text-decoration: none;
|
||||
padding: 0.65rem 1.1rem;
|
||||
border-radius: 7px;
|
||||
padding: 0.65rem 1.3rem;
|
||||
border-radius: 30px;
|
||||
font-size: 0.88rem;
|
||||
font-weight: 600;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.btn-download {
|
||||
background: var(--accent);
|
||||
color: #06211d;
|
||||
background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
|
||||
color: #fff;
|
||||
}
|
||||
.btn-download:hover { background: #5eead4; }
|
||||
.btn-download:hover { background: linear-gradient(135deg, var(--accent-hover-start), var(--accent-hover-end)); }
|
||||
|
||||
.btn-secondary {
|
||||
background: transparent;
|
||||
color: var(--text-muted);
|
||||
border: 1px solid var(--border);
|
||||
color: var(--text);
|
||||
border: 1px solid var(--border-solid);
|
||||
}
|
||||
.btn-secondary:hover { color: var(--text); border-color: var(--accent-dim); }
|
||||
.btn-secondary:hover { background: #2d2d2d; }
|
||||
|
||||
.footnote {
|
||||
margin-top: 2rem;
|
||||
@@ -290,6 +321,7 @@ pre.log {
|
||||
.footnote code {
|
||||
font-family: var(--mono);
|
||||
background: var(--surface-raised);
|
||||
color: var(--accent);
|
||||
padding: 0.1rem 0.35rem;
|
||||
border-radius: 4px;
|
||||
}
|
||||
@@ -301,3 +333,29 @@ pre.log {
|
||||
font-size: 0.7rem;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.repo-links {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
margin-top: 0.6rem;
|
||||
}
|
||||
|
||||
.repo-links a {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
color: var(--text-muted);
|
||||
font-size: 0.75rem;
|
||||
text-decoration: none;
|
||||
transition: color 0.15s ease;
|
||||
}
|
||||
|
||||
.repo-links a:hover { color: var(--text); }
|
||||
|
||||
.repo-links .icon {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.repo-links .icon img { width: 100%; height: 100%; }
|
||||
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg fill="#48cf51ff" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Gitea icon</title><path d="M4.186 5.421C2.341 5.417-.13 6.59.006 9.531c.213 4.594 4.92 5.02 6.801 5.057.206.862 2.42 3.834 4.059 3.99h7.18c4.306-.286 7.53-13.022 5.14-13.07-3.953.186-6.296.28-8.305.296v3.975l-.626-.277-.004-3.696c-2.306-.001-4.336-.108-8.189-.298-.482-.003-1.154-.085-1.876-.087zm.261 1.625h.22c.262 2.355.688 3.732 1.55 5.836-2.2-.26-4.072-.899-4.416-3.285-.178-1.235.422-2.524 2.646-2.552zm8.557 2.315c.15.002.303.03.447.096l.749.323-.537.979a.672.597 0 0 0-.241.038.672.597 0 0 0-.405.764.672.597 0 0 0 .112.174l-.926 1.686a.672.597 0 0 0-.222.038.672.597 0 0 0-.405.764.672.597 0 0 0 .86.36.672.597 0 0 0 .404-.765.672.597 0 0 0-.158-.22l.902-1.642a.672.597 0 0 0 .293-.03.672.597 0 0 0 .213-.112c.348.146.633.265.838.366.308.152.417.253.45.365.033.11-.003.322-.177.694-.13.277-.345.67-.599 1.133a.672.597 0 0 0-.251.038.672.597 0 0 0-.405.764.672.597 0 0 0 .86.36.672.597 0 0 0 .404-.764.672.597 0 0 0-.137-.202c.251-.458.467-.852.606-1.148.188-.402.286-.701.2-.99-.086-.289-.35-.477-.7-.65-.23-.113-.517-.233-.86-.377a.672.597 0 0 0-.038-.239.672.597 0 0 0-.145-.209l.528-.963 2.924 1.263c.528.229.746.79.49 1.26l-2.01 3.68c-.257.469-.888.663-1.416.435l-4.137-1.788c-.528-.228-.747-.79-.49-1.26l2.01-3.679c.176-.323.53-.515.905-.53h.064z"/></svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<title>github [#142]</title>
|
||||
<desc>Created with Sketch.</desc>
|
||||
<defs>
|
||||
|
||||
</defs>
|
||||
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g id="Dribbble-Light-Preview" transform="translate(-140.000000, -7559.000000)" fill="#ffffffff">
|
||||
<g id="icons" transform="translate(56.000000, 160.000000)">
|
||||
<path d="M94,7399 C99.523,7399 104,7403.59 104,7409.253 C104,7413.782 101.138,7417.624 97.167,7418.981 C96.66,7419.082 96.48,7418.762 96.48,7418.489 C96.48,7418.151 96.492,7417.047 96.492,7415.675 C96.492,7414.719 96.172,7414.095 95.813,7413.777 C98.04,7413.523 100.38,7412.656 100.38,7408.718 C100.38,7407.598 99.992,7406.684 99.35,7405.966 C99.454,7405.707 99.797,7404.664 99.252,7403.252 C99.252,7403.252 98.414,7402.977 96.505,7404.303 C95.706,7404.076 94.85,7403.962 94,7403.958 C93.15,7403.962 92.295,7404.076 91.497,7404.303 C89.586,7402.977 88.746,7403.252 88.746,7403.252 C88.203,7404.664 88.546,7405.707 88.649,7405.966 C88.01,7406.684 87.619,7407.598 87.619,7408.718 C87.619,7412.646 89.954,7413.526 92.175,7413.785 C91.889,7414.041 91.63,7414.493 91.54,7415.156 C90.97,7415.418 89.522,7415.871 88.63,7414.304 C88.63,7414.304 88.101,7413.319 87.097,7413.247 C87.097,7413.247 86.122,7413.234 87.029,7413.87 C87.029,7413.87 87.684,7414.185 88.139,7415.37 C88.139,7415.37 88.726,7417.2 91.508,7416.58 C91.513,7417.437 91.522,7418.245 91.522,7418.489 C91.522,7418.76 91.338,7419.077 90.839,7418.982 C86.865,7417.627 84,7413.783 84,7409.253 C84,7403.59 88.478,7399 94,7399" id="github-[#142]">
|
||||
|
||||
</path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1,153 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg id="Calque_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 7716.9 1000">
|
||||
<!-- Generator: Adobe Illustrator 30.7.0, SVG Export Plug-In . SVG Version: 2.1.4 Build 114) -->
|
||||
<defs>
|
||||
<style>
|
||||
.st0 {
|
||||
fill: #55c3ec;
|
||||
}
|
||||
|
||||
.st1 {
|
||||
fill: url(#Dégradé_sans_nom_305);
|
||||
stroke: url(#Dégradé_sans_nom_335);
|
||||
}
|
||||
|
||||
.st1, .st2, .st3, .st4, .st5, .st6, .st7, .st8, .st9, .st10, .st11, .st12 {
|
||||
stroke-miterlimit: 10;
|
||||
}
|
||||
|
||||
.st2 {
|
||||
fill: url(#Dégradé_sans_nom_308);
|
||||
stroke: url(#Dégradé_sans_nom_338);
|
||||
}
|
||||
|
||||
.st3 {
|
||||
fill: url(#Dégradé_sans_nom_301);
|
||||
stroke: url(#Dégradé_sans_nom_331);
|
||||
}
|
||||
|
||||
.st4 {
|
||||
fill: url(#Dégradé_sans_nom_309);
|
||||
stroke: url(#Dégradé_sans_nom_339);
|
||||
}
|
||||
|
||||
.st5 {
|
||||
fill: url(#Dégradé_sans_nom_303);
|
||||
stroke: url(#Dégradé_sans_nom_333);
|
||||
}
|
||||
|
||||
.st6 {
|
||||
fill: url(#Dégradé_sans_nom_304);
|
||||
stroke: url(#Dégradé_sans_nom_334);
|
||||
}
|
||||
|
||||
.st7 {
|
||||
fill: url(#Dégradé_sans_nom_302);
|
||||
stroke: url(#Dégradé_sans_nom_332);
|
||||
}
|
||||
|
||||
.st8 {
|
||||
fill: url(#Dégradé_sans_nom_307);
|
||||
stroke: url(#Dégradé_sans_nom_337);
|
||||
}
|
||||
|
||||
.st9 {
|
||||
fill: url(#Dégradé_sans_nom_306);
|
||||
stroke: url(#Dégradé_sans_nom_336);
|
||||
}
|
||||
|
||||
.st13 {
|
||||
fill: url(#Dégradé_sans_nom_391);
|
||||
}
|
||||
|
||||
.st10 {
|
||||
fill: url(#Dégradé_sans_nom_30);
|
||||
stroke: url(#Dégradé_sans_nom_33);
|
||||
}
|
||||
|
||||
.st11 {
|
||||
fill: url(#Dégradé_sans_nom_3011);
|
||||
stroke: url(#Dégradé_sans_nom_3311);
|
||||
}
|
||||
|
||||
.st12 {
|
||||
fill: url(#Dégradé_sans_nom_3010);
|
||||
stroke: url(#Dégradé_sans_nom_3310);
|
||||
}
|
||||
|
||||
.st14 {
|
||||
fill: #fff;
|
||||
}
|
||||
|
||||
.st15 {
|
||||
fill: url(#Dégradé_sans_nom_39);
|
||||
}
|
||||
</style>
|
||||
<linearGradient id="Dégradé_sans_nom_39" data-name="Dégradé sans nom 39" x1="244.5" y1="503" x2="746.5" y2="503" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0" stop-color="#55c2eb"/>
|
||||
<stop offset="1" stop-color="#1d70b7" stop-opacity=".8"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="Dégradé_sans_nom_391" data-name="Dégradé sans nom 39" x1="398.9" y1="504.3" x2="594.6" y2="504.3" xlink:href="#Dégradé_sans_nom_39"/>
|
||||
<linearGradient id="Dégradé_sans_nom_30" data-name="Dégradé sans nom 30" x1="74" y1="560.2" x2="105.7" y2="591.8" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0" stop-color="#55c2eb"/>
|
||||
<stop offset="1" stop-color="#1d70b7" stop-opacity=".8"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="Dégradé_sans_nom_33" data-name="Dégradé sans nom 33" x1="73.7" y1="559.9" x2="106" y2="592.2" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0" stop-color="#55c2eb"/>
|
||||
<stop offset="1" stop-color="#1d70b7" stop-opacity=".5"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="Dégradé_sans_nom_301" data-name="Dégradé sans nom 30" x1="1430.9" y1="2772.1" x2="1449.5" y2="2790.7" gradientTransform="translate(1863.806 -2030.0199) rotate(60)" xlink:href="#Dégradé_sans_nom_30"/>
|
||||
<linearGradient id="Dégradé_sans_nom_331" data-name="Dégradé sans nom 33" x1="1430.6" y1="2771.8" x2="1449.9" y2="2791" gradientTransform="translate(1863.806 -2030.0199) rotate(60)" xlink:href="#Dégradé_sans_nom_33"/>
|
||||
<linearGradient id="Dégradé_sans_nom_302" data-name="Dégradé sans nom 30" x1="3365.6" y1="3054.2" x2="3405.2" y2="3093.8" gradientTransform="translate(3985.7456 -1782.7635) rotate(105)" xlink:href="#Dégradé_sans_nom_30"/>
|
||||
<linearGradient id="Dégradé_sans_nom_332" data-name="Dégradé sans nom 33" x1="3365.2" y1="3053.9" x2="3405.5" y2="3094.2" gradientTransform="translate(3985.7456 -1782.7635) rotate(105)" xlink:href="#Dégradé_sans_nom_33"/>
|
||||
<linearGradient id="Dégradé_sans_nom_303" data-name="Dégradé sans nom 30" x1="3101.3" y1="2411.8" x2="3140.9" y2="2451.4" gradientTransform="translate(3985.7456 -1782.7635) rotate(105)" xlink:href="#Dégradé_sans_nom_30"/>
|
||||
<linearGradient id="Dégradé_sans_nom_333" data-name="Dégradé sans nom 33" x1="3100.9" y1="2411.4" x2="3141.2" y2="2451.7" gradientTransform="translate(3985.7456 -1782.7635) rotate(105)" xlink:href="#Dégradé_sans_nom_33"/>
|
||||
<linearGradient id="Dégradé_sans_nom_304" data-name="Dégradé sans nom 30" x1="1757.9" y1="2114.1" x2="1776.4" y2="2132.7" gradientTransform="translate(1863.806 -2030.0199) rotate(60)" xlink:href="#Dégradé_sans_nom_30"/>
|
||||
<linearGradient id="Dégradé_sans_nom_334" data-name="Dégradé sans nom 33" x1="1757.5" y1="2113.8" x2="1776.8" y2="2133.1" gradientTransform="translate(1863.806 -2030.0199) rotate(60)" xlink:href="#Dégradé_sans_nom_33"/>
|
||||
<linearGradient id="Dégradé_sans_nom_305" data-name="Dégradé sans nom 30" x1="824.6" y1="682.3" x2="856.3" y2="713.9" xlink:href="#Dégradé_sans_nom_30"/>
|
||||
<linearGradient id="Dégradé_sans_nom_335" data-name="Dégradé sans nom 33" x1="824.3" y1="681.9" x2="856.6" y2="714.3" xlink:href="#Dégradé_sans_nom_33"/>
|
||||
<linearGradient id="Dégradé_sans_nom_306" data-name="Dégradé sans nom 30" x1="3463.8" y1="2696" x2="3495.6" y2="2727.9" gradientTransform="translate(3985.7456 -1782.7635) rotate(105)" xlink:href="#Dégradé_sans_nom_30"/>
|
||||
<linearGradient id="Dégradé_sans_nom_336" data-name="Dégradé sans nom 33" x1="3463.4" y1="2695.7" x2="3496" y2="2728.2" gradientTransform="translate(3985.7456 -1782.7635) rotate(105)" xlink:href="#Dégradé_sans_nom_33"/>
|
||||
<linearGradient id="Dégradé_sans_nom_307" data-name="Dégradé sans nom 30" x1="1813.2" y1="2573.7" x2="1831.8" y2="2592.3" gradientTransform="translate(1863.806 -2030.0199) rotate(60)" xlink:href="#Dégradé_sans_nom_30"/>
|
||||
<linearGradient id="Dégradé_sans_nom_337" data-name="Dégradé sans nom 33" x1="1812.8" y1="2573.4" x2="1832.1" y2="2592.6" gradientTransform="translate(1863.806 -2030.0199) rotate(60)" xlink:href="#Dégradé_sans_nom_33"/>
|
||||
<linearGradient id="Dégradé_sans_nom_308" data-name="Dégradé sans nom 30" x1="4603" y1="48.2" x2="4642.6" y2="87.7" gradientTransform="translate(5288.3589 605.3909) rotate(-175.4391)" xlink:href="#Dégradé_sans_nom_30"/>
|
||||
<linearGradient id="Dégradé_sans_nom_338" data-name="Dégradé sans nom 33" x1="4602.7" y1="47.8" x2="4643" y2="88.1" gradientTransform="translate(5288.3589 605.3909) rotate(-175.4391)" xlink:href="#Dégradé_sans_nom_33"/>
|
||||
<linearGradient id="Dégradé_sans_nom_309" data-name="Dégradé sans nom 30" x1="4500.7" y1="1503.6" x2="4519.3" y2="1522.2" gradientTransform="translate(5147.0477 -1526.227) rotate(139.5609)" xlink:href="#Dégradé_sans_nom_30"/>
|
||||
<linearGradient id="Dégradé_sans_nom_339" data-name="Dégradé sans nom 33" x1="4500.4" y1="1503.3" x2="4519.6" y2="1522.5" gradientTransform="translate(5147.0477 -1526.227) rotate(139.5609)" xlink:href="#Dégradé_sans_nom_33"/>
|
||||
<linearGradient id="Dégradé_sans_nom_3010" data-name="Dégradé sans nom 30" x1="2951" y1="2709.4" x2="2980.8" y2="2739.3" gradientTransform="translate(3343.1844 -2356.0981) rotate(97.9139)" xlink:href="#Dégradé_sans_nom_30"/>
|
||||
<linearGradient id="Dégradé_sans_nom_3310" data-name="Dégradé sans nom 33" x1="2950.6" y1="2709.1" x2="2981.2" y2="2739.6" gradientTransform="translate(3343.1844 -2356.0981) rotate(97.9139)" xlink:href="#Dégradé_sans_nom_33"/>
|
||||
<linearGradient id="Dégradé_sans_nom_3011" data-name="Dégradé sans nom 30" x1="1450.8" y1="2212.6" x2="1469.4" y2="2231.2" gradientTransform="translate(1206.9506 -2339.7003) rotate(52.9139)" xlink:href="#Dégradé_sans_nom_30"/>
|
||||
<linearGradient id="Dégradé_sans_nom_3311" data-name="Dégradé sans nom 33" x1="1450.4" y1="2212.3" x2="1469.7" y2="2231.6" gradientTransform="translate(1206.9506 -2339.7003) rotate(52.9139)" xlink:href="#Dégradé_sans_nom_33"/>
|
||||
</defs>
|
||||
<g id="Calque_11" data-name="Calque_1">
|
||||
<circle class="st14" cx="499.5" cy="499.5" r="499.5"/>
|
||||
</g>
|
||||
<g>
|
||||
<path class="st14" d="M1417.4,957.4V59h228.5v898.4h-228.5Z"/>
|
||||
<path class="st14" d="M1767.3,957.4V279.4h221v119.5h4.4c17.4-42.8,43.4-75.7,77.8-99,34.4-23.2,77.2-34.9,128.2-34.9,74.7,0,132.3,22.5,172.8,67.5s60.7,107.8,60.7,188.3v436.4h-221v-389.1c0-38.6-9.1-68.8-27.4-90.6-18.3-21.8-45.5-32.7-81.5-32.7s-43.4,5.4-60.4,16.2-30.2,25.7-39.5,44.8c-9.3,19.1-14,41.3-14,66.6v384.7h-221Z"/>
|
||||
<path class="st14" d="M2833.1,971.7c-67.2,0-124.1-9.2-170.6-27.7-46.5-18.5-82.6-44.3-108.3-77.5-25.7-33.2-41.1-71.8-46.1-115.8l-.6-5.6h214.2l1.2,5c5.4,22.8,17.1,40.7,35.2,53.5,18,12.9,43,19.3,75,19.3s36.3-2.3,50.4-6.8,24.9-11.1,32.4-19.6,11.2-18.4,11.2-29.6v-.6c0-14.9-6.1-27.1-18.4-36.4-12.2-9.3-33.5-17.1-63.8-23.4l-119.5-23c-44-8.7-81-22.1-111.1-40.2-30.1-18-52.7-40.4-67.8-66.9-15.2-26.6-22.7-57.1-22.7-91.5v-.6c0-45.2,12.1-84.1,36.4-116.7,24.3-32.6,59.1-57.8,104.6-75.6,45.4-17.8,98.9-26.8,160.3-26.8s120.7,10.1,165.3,30.2c44.6,20.1,78.5,46.9,101.8,80.3,23.2,33.4,35.1,70.5,35.5,111.1v5h-201.7l-.6-5c-2.1-19.9-11.6-37-28.6-51.4-17-14.3-40.9-21.5-71.6-21.5s-33.4,2.4-46.7,7.2-23.6,11.4-30.8,19.9-10.9,18.8-10.9,30.8v.6c0,9.5,2.5,18,7.5,25.5,5,7.5,13.7,13.9,26.1,19.3,12.5,5.4,29.5,10.4,51.1,15l118.9,23.7c72.6,14.1,125.2,36,157.8,65.7,32.6,29.7,48.9,69.8,48.9,120.5v.6c0,46.5-13.3,87-39.8,121.4-26.6,34.5-63.3,61-110.2,79.7-46.9,18.7-101.5,28-163.7,28Z"/>
|
||||
<path class="st14" d="M3519.2,971.7c-81.8,0-142-16.3-180.9-48.9s-58.2-87-58.2-163.4v-318.1h-92.1v-161.9h92.1V123.1h221.6v156.3h121.4v161.9h-121.4v288.2c0,29.1,6.6,49.7,19.9,62s33.2,18.4,59.8,18.4,16.8-.3,23-.9,12.5-1.3,18.7-2.2v156.9c-12,2.1-26.6,4-43.6,5.6s-37.1,2.5-60.4,2.5Z"/>
|
||||
<path class="st14" d="M3914.5,966.7c-45.2,0-85.1-8.8-119.5-26.5-34.5-17.6-61.3-41.9-80.6-72.8-19.3-30.9-29-66.1-29-105.5v-.6c0-42.8,10.7-79.1,32.1-108.9s52.4-53.4,93.1-70.7,90.1-27.7,148.2-31.5l271.4-17.4v128.2l-235.9,16.2c-30.7,1.7-53.8,8.6-69.1,20.9-15.4,12.2-23,28.5-23,48.9v.6c0,21.2,8.2,37.5,24.6,48.9s38.1,17.1,65.1,17.1,44.5-4.2,62.6-12.8c18.1-8.5,32.4-20.3,43-35.5,10.6-15.1,15.9-32,15.9-50.7v-207.9c0-24.5-7.9-43.9-23.7-58.2-15.8-14.3-38.8-21.5-69.1-21.5s-53.3,6-70.4,18.1-27.4,26.8-31.1,44.2l-1.2,6.2h-199.2l.6-8.1c3.7-44.4,18.2-83.2,43.6-116.4s60.7-59.1,106.2-77.8c45.4-18.7,99.7-28,162.8-28s113.6,9.5,159.1,28.6c45.4,19.1,80.7,45.9,105.8,80.3,25.1,34.5,37.7,74.5,37.7,120.2v463.2h-221v-95.9h-4.4c-12.9,22-28.8,40.9-47.9,56.7-19.1,15.8-40.9,27.8-65.4,36.1s-51.5,12.5-80.9,12.5Z"/>
|
||||
<path class="st14" d="M4439.3,957.4V279.4h221v122h4.4c13.3-41.5,36.9-74.6,71-99.3s74.3-37,120.8-37,61.2,5.7,86.5,17.1,46.5,27.8,63.5,49.2,28.6,47.6,34.9,78.8h4.4c8.7-29.5,23.1-55,43.2-76.6s44.4-38.4,72.8-50.4,59.5-18.1,93.1-18.1,83.2,9.7,116.4,29,59.1,46.3,77.8,80.9c18.7,34.7,28,75,28,121.1v461.3h-221v-404.7c0-23.7-3.5-43.5-10.6-59.5-7.1-16-17.6-28-31.8-36.1s-31.8-12.1-52.9-12.1-36.6,4.6-51.4,13.7-26,21.8-33.9,38c-7.9,16.2-11.8,35.7-11.8,58.5v402.2h-211v-406.5c0-23.2-3.6-42.6-10.9-58.2-7.3-15.6-17.8-27.4-31.8-35.5s-31-12.1-51.3-12.1-37.3,4.7-52,14-26.1,22.3-34.2,38.9c-8.1,16.6-12.1,36.1-12.1,58.5v400.9h-221Z"/>
|
||||
<path class="st0" d="M5904.8,971.7c-71.4,0-132.8-14.2-184.3-42.6s-91-69-118.6-121.7-41.4-115.6-41.4-188.6v-.6c0-72.6,13.8-135.3,41.4-188,27.6-52.7,66.6-93.4,117-122,50.4-28.6,109.9-43,178.4-43s127.8,14,178.1,42,89,67.4,116.4,118.3,41.1,110.5,41.1,179v64.7h-564v-130.7h460.7l-102.7,122.6v-85.3c0-32.8-5.2-60.7-15.6-83.7-10.4-23-24.9-40.5-43.6-52.3-18.7-11.8-40.5-17.8-65.4-17.8s-46.8,6-65.7,18.1-33.5,29.6-43.9,52.6c-10.4,23-15.6,50.7-15.6,83.1v85.9c0,32,5.3,59.4,15.9,82.2,10.6,22.8,25.7,40.4,45.4,52.6s43.3,18.4,70.7,18.4,43.8-3.7,60.4-11.2c16.6-7.5,29.8-16.6,39.5-27.4s16.3-21,19.6-30.5l.6-2.5h199.2l-1.9,7.5c-5,23.7-14.5,48.2-28.6,73.8-14.1,25.5-33.7,49.5-58.8,71.9s-56.9,40.6-95.2,54.5c-38.4,13.9-84.8,20.8-139.1,20.8Z"/>
|
||||
<path class="st0" d="M6641.3,971.7c-71.4,0-132.8-14.2-184.3-42.6s-91-69-118.6-121.7-41.4-115.6-41.4-188.6v-.6c0-72.6,13.8-135.3,41.4-188,27.6-52.7,66.6-93.4,117-122,50.4-28.6,109.9-43,178.4-43s127.8,14,178.1,42,89,67.4,116.4,118.3,41.1,110.5,41.1,179v64.7h-564v-130.7h460.7l-102.7,122.6v-85.3c0-32.8-5.2-60.7-15.6-83.7-10.4-23-24.9-40.5-43.6-52.3-18.7-11.8-40.5-17.8-65.4-17.8s-46.8,6-65.7,18.1-33.5,29.6-43.9,52.6c-10.4,23-15.6,50.7-15.6,83.1v85.9c0,32,5.3,59.4,15.9,82.2,10.6,22.8,25.7,40.4,45.4,52.6s43.3,18.4,70.7,18.4,43.8-3.7,60.4-11.2c16.6-7.5,29.8-16.6,39.5-27.4s16.3-21,19.6-30.5l.6-2.5h199.2l-1.9,7.5c-5,23.7-14.5,48.2-28.6,73.8-14.1,25.5-33.7,49.5-58.8,71.9s-56.9,40.6-95.2,54.5c-38.4,13.9-84.8,20.8-139.1,20.8Z"/>
|
||||
<path class="st0" d="M7003.7,957.4l203-336.8-202.3-341.2h249.7l100.2,216.7h4.3l100.2-216.7h238.4l-203,336.2,202.3,341.8h-239.1l-111.4-222.9h-4.4l-109,222.9h-229.1Z"/>
|
||||
</g>
|
||||
<circle class="st14" cx="499" cy="499.5" r="499.5"/>
|
||||
<g>
|
||||
<path class="st15" d="M617.8,252h-244.6c-72.1,0-128.7,59.2-128.7,128.7v244.6c0,72.1,59.2,128.7,128.7,128.7h244.6c72.1,0,128.7-59.2,128.7-128.7v-244.6c0-72.1-59.2-128.7-128.7-128.7ZM496.8,656.2c-82.4,0-151.9-69.5-151.9-151.9s66.9-151.9,151.9-151.9,151.9,69.5,151.9,151.9-69.5,151.9-151.9,151.9ZM659,378.2c-20.6,0-36-15.4-36-36s15.4-36,36-36,36,15.4,36,36c0,20.6-15.4,36-36,36Z"/>
|
||||
<path class="st13" d="M496.8,406.5c-54.1,0-97.8,43.8-97.8,97.8s43.8,97.8,97.8,97.8,97.8-43.8,97.8-97.8-43.8-97.8-97.8-97.8Z"/>
|
||||
</g>
|
||||
<circle class="st10" cx="89.9" cy="576" r="22.4"/>
|
||||
<circle class="st3" cx="175.1" cy="607.9" r="13.1"/>
|
||||
<circle class="st7" cx="140.3" cy="691.6" r="28"/>
|
||||
<circle class="st5" cx="829.2" cy="602.6" r="28"/>
|
||||
<circle class="st6" cx="908.4" cy="562.1" r="13.1"/>
|
||||
<circle class="st1" cx="840.4" cy="698.1" r="22.4"/>
|
||||
<circle class="st9" cx="465.6" cy="876.5" r="22.5"/>
|
||||
<circle class="st8" cx="538.1" cy="839.8" r="13.1"/>
|
||||
<circle class="st2" cx="685.6" cy="170.1" r="28"/>
|
||||
<circle class="st4" cx="733.2" cy="247.7" r="13.1"/>
|
||||
<circle class="st12" cx="236.4" cy="206.5" r="21.1"/>
|
||||
<circle class="st11" cx="314.9" cy="164.9" r="13.1"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 14 KiB |
@@ -0,0 +1,141 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 1000 1000">
|
||||
<!-- Generator: Adobe Illustrator 30.7.0, SVG Export Plug-In . SVG Version: 2.1.4 Build 114) -->
|
||||
<defs>
|
||||
<style>
|
||||
.st0 {
|
||||
fill: url(#Dégradé_sans_nom_5);
|
||||
}
|
||||
|
||||
.st1 {
|
||||
fill: url(#Dégradé_sans_nom_264);
|
||||
stroke: url(#Dégradé_sans_nom_334);
|
||||
}
|
||||
|
||||
.st1, .st2, .st3, .st4, .st5, .st6, .st7, .st8, .st9, .st10, .st11, .st12 {
|
||||
stroke-miterlimit: 10;
|
||||
}
|
||||
|
||||
.st2 {
|
||||
fill: url(#Dégradé_sans_nom_262);
|
||||
stroke: url(#Dégradé_sans_nom_332);
|
||||
}
|
||||
|
||||
.st3 {
|
||||
fill: url(#Dégradé_sans_nom_269);
|
||||
stroke: url(#Dégradé_sans_nom_339);
|
||||
}
|
||||
|
||||
.st4 {
|
||||
fill: url(#Dégradé_sans_nom_263);
|
||||
stroke: url(#Dégradé_sans_nom_333);
|
||||
}
|
||||
|
||||
.st5 {
|
||||
fill: url(#Dégradé_sans_nom_265);
|
||||
stroke: url(#Dégradé_sans_nom_335);
|
||||
}
|
||||
|
||||
.st6 {
|
||||
fill: url(#Dégradé_sans_nom_268);
|
||||
stroke: url(#Dégradé_sans_nom_338);
|
||||
}
|
||||
|
||||
.st7 {
|
||||
fill: url(#Dégradé_sans_nom_261);
|
||||
stroke: url(#Dégradé_sans_nom_331);
|
||||
}
|
||||
|
||||
.st8 {
|
||||
fill: url(#Dégradé_sans_nom_266);
|
||||
stroke: url(#Dégradé_sans_nom_336);
|
||||
}
|
||||
|
||||
.st9 {
|
||||
fill: url(#Dégradé_sans_nom_267);
|
||||
stroke: url(#Dégradé_sans_nom_337);
|
||||
}
|
||||
|
||||
.st10 {
|
||||
fill: url(#Dégradé_sans_nom_26);
|
||||
stroke: url(#Dégradé_sans_nom_33);
|
||||
}
|
||||
|
||||
.st11 {
|
||||
fill: url(#Dégradé_sans_nom_2610);
|
||||
stroke: url(#Dégradé_sans_nom_3310);
|
||||
}
|
||||
|
||||
.st12 {
|
||||
fill: url(#Dégradé_sans_nom_2611);
|
||||
stroke: url(#Dégradé_sans_nom_3311);
|
||||
}
|
||||
|
||||
.st13 {
|
||||
fill: #fff;
|
||||
}
|
||||
|
||||
.st14 {
|
||||
fill: url(#Dégradé_sans_nom_51);
|
||||
}
|
||||
</style>
|
||||
<linearGradient id="Dégradé_sans_nom_5" data-name="Dégradé sans nom 5" x1="245" y1="503" x2="747" y2="503" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0" stop-color="#55c3ec"/>
|
||||
<stop offset="1" stop-color="#1d71b8" stop-opacity=".8"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="Dégradé_sans_nom_51" data-name="Dégradé sans nom 5" x1="399.4" y1="504.3" x2="595.1" y2="504.3" xlink:href="#Dégradé_sans_nom_5"/>
|
||||
<linearGradient id="Dégradé_sans_nom_26" data-name="Dégradé sans nom 26" x1="74.5" y1="560.2" x2="106.2" y2="591.8" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0" stop-color="#55c3ec"/>
|
||||
<stop offset="1" stop-color="#1d71b8" stop-opacity=".8"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="Dégradé_sans_nom_33" data-name="Dégradé sans nom 33" x1="74.2" y1="559.9" x2="106.5" y2="592.2" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0" stop-color="#55c3ec"/>
|
||||
<stop offset="1" stop-color="#1d71b8" stop-opacity=".5"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="Dégradé_sans_nom_261" data-name="Dégradé sans nom 26" x1="158.2" y1="648.8" x2="176.7" y2="667.3" gradientTransform="translate(661.8 133.9) rotate(60)" xlink:href="#Dégradé_sans_nom_26"/>
|
||||
<linearGradient id="Dégradé_sans_nom_331" data-name="Dégradé sans nom 33" x1="157.8" y1="648.4" x2="177.1" y2="667.7" gradientTransform="translate(661.8 133.9) rotate(60)" xlink:href="#Dégradé_sans_nom_33"/>
|
||||
<linearGradient id="Dégradé_sans_nom_262" data-name="Dégradé sans nom 26" x1="210.2" y1="714.7" x2="249.8" y2="754.3" gradientTransform="translate(909.8 659.5) rotate(105)" xlink:href="#Dégradé_sans_nom_26"/>
|
||||
<linearGradient id="Dégradé_sans_nom_332" data-name="Dégradé sans nom 33" x1="209.9" y1="714.3" x2="250.2" y2="754.6" gradientTransform="translate(909.8 659.5) rotate(105)" xlink:href="#Dégradé_sans_nom_33"/>
|
||||
<linearGradient id="Dégradé_sans_nom_263" data-name="Dégradé sans nom 26" x1="-54" y1="72.2" x2="-14.4" y2="111.8" gradientTransform="translate(909.8 659.5) rotate(105)" xlink:href="#Dégradé_sans_nom_26"/>
|
||||
<linearGradient id="Dégradé_sans_nom_333" data-name="Dégradé sans nom 33" x1="-54.4" y1="71.9" x2="-14.1" y2="112.2" gradientTransform="translate(909.8 659.5) rotate(105)" xlink:href="#Dégradé_sans_nom_33"/>
|
||||
<linearGradient id="Dégradé_sans_nom_264" data-name="Dégradé sans nom 26" x1="485.1" y1="-9.2" x2="503.7" y2="9.4" gradientTransform="translate(661.8 133.9) rotate(60)" xlink:href="#Dégradé_sans_nom_26"/>
|
||||
<linearGradient id="Dégradé_sans_nom_334" data-name="Dégradé sans nom 33" x1="484.8" y1="-9.6" x2="504" y2="9.7" gradientTransform="translate(661.8 133.9) rotate(60)" xlink:href="#Dégradé_sans_nom_33"/>
|
||||
<linearGradient id="Dégradé_sans_nom_265" data-name="Dégradé sans nom 26" x1="825.1" y1="682.3" x2="856.8" y2="713.9" xlink:href="#Dégradé_sans_nom_26"/>
|
||||
<linearGradient id="Dégradé_sans_nom_335" data-name="Dégradé sans nom 33" x1="824.8" y1="681.9" x2="857.1" y2="714.3" xlink:href="#Dégradé_sans_nom_33"/>
|
||||
<linearGradient id="Dégradé_sans_nom_266" data-name="Dégradé sans nom 26" x1="308.5" y1="356.5" x2="340.3" y2="388.3" gradientTransform="translate(909.8 659.5) rotate(105)" xlink:href="#Dégradé_sans_nom_26"/>
|
||||
<linearGradient id="Dégradé_sans_nom_336" data-name="Dégradé sans nom 33" x1="308.1" y1="356.2" x2="340.7" y2="388.7" gradientTransform="translate(909.8 659.5) rotate(105)" xlink:href="#Dégradé_sans_nom_33"/>
|
||||
<linearGradient id="Dégradé_sans_nom_267" data-name="Dégradé sans nom 26" x1="540.4" y1="450.4" x2="559" y2="469" gradientTransform="translate(661.8 133.9) rotate(60)" xlink:href="#Dégradé_sans_nom_26"/>
|
||||
<linearGradient id="Dégradé_sans_nom_337" data-name="Dégradé sans nom 33" x1="540.1" y1="450" x2="559.4" y2="469.3" gradientTransform="translate(661.8 133.9) rotate(60)" xlink:href="#Dégradé_sans_nom_33"/>
|
||||
<linearGradient id="Dégradé_sans_nom_268" data-name="Dégradé sans nom 26" x1="-336.4" y1="326.9" x2="-296.8" y2="366.5" gradientTransform="translate(342.9 490.5) rotate(-175.4)" xlink:href="#Dégradé_sans_nom_26"/>
|
||||
<linearGradient id="Dégradé_sans_nom_338" data-name="Dégradé sans nom 33" x1="-336.7" y1="326.5" x2="-296.4" y2="366.8" gradientTransform="translate(342.9 490.5) rotate(-175.4)" xlink:href="#Dégradé_sans_nom_33"/>
|
||||
<linearGradient id="Dégradé_sans_nom_269" data-name="Dégradé sans nom 26" x1="115" y1="-29.9" x2="133.6" y2="-11.3" gradientTransform="translate(814.9 151.4) rotate(139.6)" xlink:href="#Dégradé_sans_nom_26"/>
|
||||
<linearGradient id="Dégradé_sans_nom_339" data-name="Dégradé sans nom 33" x1="114.7" y1="-30.2" x2="134" y2="-11" gradientTransform="translate(814.9 151.4) rotate(139.6)" xlink:href="#Dégradé_sans_nom_33"/>
|
||||
<linearGradient id="Dégradé_sans_nom_2610" data-name="Dégradé sans nom 26" x1="94.5" y1="304.2" x2="124.4" y2="334" gradientTransform="translate(568 142) rotate(97.9)" xlink:href="#Dégradé_sans_nom_26"/>
|
||||
<linearGradient id="Dégradé_sans_nom_3310" data-name="Dégradé sans nom 33" x1="94.2" y1="303.8" x2="124.7" y2="334.4" gradientTransform="translate(568 142) rotate(97.9)" xlink:href="#Dégradé_sans_nom_33"/>
|
||||
<linearGradient id="Dégradé_sans_nom_2611" data-name="Dégradé sans nom 26" x1="435.8" y1="254.1" x2="454.4" y2="272.7" gradientTransform="translate(257.1 -349) rotate(52.9)" xlink:href="#Dégradé_sans_nom_26"/>
|
||||
<linearGradient id="Dégradé_sans_nom_3311" data-name="Dégradé sans nom 33" x1="435.5" y1="253.8" x2="454.8" y2="273.1" gradientTransform="translate(257.1 -349) rotate(52.9)" xlink:href="#Dégradé_sans_nom_33"/>
|
||||
</defs>
|
||||
<g id="Calque_1">
|
||||
<circle class="st13" cx="499.5" cy="499.5" r="499.5"/>
|
||||
<g>
|
||||
<path class="st0" d="M618.3,252h-244.6c-72.1,0-128.7,59.2-128.7,128.7v244.6c0,72.1,59.2,128.7,128.7,128.7h244.6c72.1,0,128.7-59.2,128.7-128.7v-244.6c0-72.1-59.2-128.7-128.7-128.7ZM497.3,656.2c-82.4,0-151.9-69.5-151.9-151.9s66.9-151.9,151.9-151.9,151.9,69.5,151.9,151.9-69.5,151.9-151.9,151.9ZM659.5,378.2c-20.6,0-36-15.4-36-36s15.4-36,36-36,36,15.4,36,36c0,20.6-15.4,36-36,36Z"/>
|
||||
<path class="st14" d="M497.3,406.5c-54.1,0-97.8,43.8-97.8,97.8s43.8,97.8,97.8,97.8,97.8-43.8,97.8-97.8-43.8-97.8-97.8-97.8Z"/>
|
||||
</g>
|
||||
</g>
|
||||
<g id="Calque_2">
|
||||
<g id="Calque_3">
|
||||
<circle class="st10" cx="90.4" cy="576" r="22.4"/>
|
||||
<circle class="st7" cx="175.6" cy="607.9" r="13.1"/>
|
||||
<circle class="st2" cx="140.8" cy="691.6" r="28"/>
|
||||
<circle class="st4" cx="829.7" cy="602.6" r="28"/>
|
||||
<circle class="st1" cx="908.9" cy="562.1" r="13.1"/>
|
||||
<circle class="st5" cx="840.9" cy="698.1" r="22.4"/>
|
||||
<circle class="st8" cx="466.1" cy="876.5" r="22.5"/>
|
||||
<circle class="st9" cx="538.6" cy="839.8" r="13.1"/>
|
||||
<circle class="st6" cx="686.1" cy="170.1" r="28"/>
|
||||
<circle class="st3" cx="733.7" cy="247.7" r="13.1"/>
|
||||
<circle class="st11" cx="236.9" cy="206.5" r="21.1"/>
|
||||
<circle class="st12" cx="315.4" cy="164.9" r="13.1"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 8.8 KiB |
@@ -2,15 +2,15 @@
|
||||
from flask import Flask
|
||||
|
||||
from . import jobs
|
||||
from .config import BASE_DIR, MAX_CONTENT_LENGTH, VERSION
|
||||
from .config import ASSETS_DIR, MAX_CONTENT_LENGTH, TEMPLATES_DIR, VERSION
|
||||
from .routes import register_routes
|
||||
|
||||
|
||||
def create_app() -> Flask:
|
||||
app = Flask(
|
||||
__name__,
|
||||
template_folder=str(BASE_DIR / "templates"),
|
||||
static_folder=str(BASE_DIR / "static"),
|
||||
template_folder=str(TEMPLATES_DIR),
|
||||
static_folder=str(ASSETS_DIR),
|
||||
)
|
||||
app.config["MAX_CONTENT_LENGTH"] = MAX_CONTENT_LENGTH
|
||||
|
||||
@@ -226,6 +226,8 @@ def _tiff_max_boost(hdr_linear: np.ndarray, sdr_420: Path) -> float:
|
||||
sdr_linear = _jpeg_to_linear(sdr_420)
|
||||
real_signal = sdr_linear > 0.005
|
||||
ratio = hdr_linear[real_signal] / sdr_linear[real_signal]
|
||||
if ratio.size == 0:
|
||||
return 1.0 # all-black SDR: nothing to boost
|
||||
n = min(32, ratio.size)
|
||||
return float(np.partition(ratio, -n)[-n])
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
"""Shared constants for the HDR-to-Instagram web front."""
|
||||
from pathlib import Path
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
JOBS_DIR = BASE_DIR / "jobs"
|
||||
VERSION = (BASE_DIR / "VERSION").read_text().strip()
|
||||
# This file lives at <repo root>/src/script/app/config.py.
|
||||
SRC_DIR = Path(__file__).resolve().parent.parent.parent
|
||||
REPO_ROOT = SRC_DIR.parent
|
||||
|
||||
TEMPLATES_DIR = SRC_DIR / "templates"
|
||||
ASSETS_DIR = SRC_DIR / "assets"
|
||||
JOBS_DIR = REPO_ROOT / "jobs"
|
||||
VERSION = (REPO_ROOT / "VERSION").read_text().strip()
|
||||
|
||||
ALLOWED_SDR_EXT = {".jpg", ".jpeg"}
|
||||
ALLOWED_HDR_EXT = {".jpg", ".jpeg", ".tif", ".tiff"}
|
||||
@@ -8,7 +8,7 @@ from flask import abort, redirect, render_template, request, send_file, url_for
|
||||
from . import assembler, jobs, validation
|
||||
|
||||
|
||||
def _process_pair(job_dir, index, sdr_file, hdr_file):
|
||||
def _process_pair(job_dir, index, sdr_file, hdr_file, ignore_ig_resolution=False):
|
||||
"""Runs one SDR/HDR pair through validation + assembly. Returns an item
|
||||
dict for the job report; never raises — failures are recorded in it."""
|
||||
name = hdr_file.filename or sdr_file.filename or f"pair {index}"
|
||||
@@ -28,7 +28,7 @@ def _process_pair(job_dir, index, sdr_file, hdr_file):
|
||||
sdr_file.save(sdr_path)
|
||||
hdr_file.save(hdr_path)
|
||||
|
||||
ig_error = validation.instagram_resolution_error(sdr_path, hdr_path)
|
||||
ig_error = validation.instagram_resolution_error(sdr_path, hdr_path, ignore_ig_resolution)
|
||||
if ig_error:
|
||||
for p in (sdr_path, hdr_path):
|
||||
p.unlink(missing_ok=True)
|
||||
@@ -62,11 +62,13 @@ def register_routes(app):
|
||||
if len(sdr_files) != len(hdr_files):
|
||||
return render_template("index.html", error="Each pair needs both an SDR and an HDR file."), 400
|
||||
|
||||
ignore_ig_resolution = request.form.get("ignore_ig_resolution") == "on"
|
||||
|
||||
job_id = uuid.uuid4().hex[:12]
|
||||
job_dir = jobs.new_job_dir(job_id)
|
||||
|
||||
items = [
|
||||
_process_pair(job_dir, i, sdr_file, hdr_file)
|
||||
_process_pair(job_dir, i, sdr_file, hdr_file, ignore_ig_resolution)
|
||||
for i, (sdr_file, hdr_file) in enumerate(zip(sdr_files, hdr_files), start=1)
|
||||
]
|
||||
|
||||
@@ -42,9 +42,17 @@ def probe_dimensions(path: Path) -> tuple[int, int]:
|
||||
raise ValueError(f"could not read image dimensions ({e})") from e
|
||||
|
||||
|
||||
def instagram_resolution_error(sdr_path: Path, hdr_path: Path) -> str | None:
|
||||
def instagram_resolution_error(
|
||||
sdr_path: Path, hdr_path: Path, ignore_ig_resolution: bool = False,
|
||||
) -> str | None:
|
||||
"""Returns an error message if the pair doesn't meet Instagram's feed
|
||||
requirements, otherwise None."""
|
||||
requirements, otherwise None.
|
||||
|
||||
The dimension-match check always applies: mismatched SDR/HDR
|
||||
dimensions misalign the gain map regardless of what platform the
|
||||
result is for. ignore_ig_resolution skips only the exact-match check
|
||||
against Instagram's own feed resolutions, for results meant for
|
||||
somewhere other than Instagram."""
|
||||
try:
|
||||
sdr_w, sdr_h = probe_dimensions(sdr_path)
|
||||
hdr_w, hdr_h = probe_dimensions(hdr_path)
|
||||
@@ -57,7 +65,7 @@ def instagram_resolution_error(sdr_path: Path, hdr_path: Path) -> str | None:
|
||||
"dimensions, otherwise the gain map will misalign."
|
||||
)
|
||||
|
||||
if (sdr_w, sdr_h) not in IG_RESOLUTIONS:
|
||||
if not ignore_ig_resolution and (sdr_w, sdr_h) not in IG_RESOLUTIONS:
|
||||
allowed = ", ".join(f"{w}x{h} ({label})" for (w, h), label in IG_RESOLUTIONS.items())
|
||||
return f"Image is {sdr_w}x{sdr_h} — Instagram requires an exact match to one of: {allowed}."
|
||||
|
||||
@@ -3,12 +3,13 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Instagram HDR Assembler</title>
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
||||
<title>Instameex</title>
|
||||
<link rel="icon" type="image/svg+xml" href="{{ url_for('static', filename='img/logo.svg') }}">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrap">
|
||||
<p class="eyebrow">Instagram HDR Assembler</p>
|
||||
<img class="logo" src="{{ url_for('static', filename='img/logo-long.svg') }}" alt="Instameex">
|
||||
<h1>Build your HDR JPEG for Instagram</h1>
|
||||
<p class="subtitle">Drop your SDR export and your HDR export from Lightroom / Camera Raw. The script does the rest — gain map, 4:2:0 subsampling, Instagram metadata injection. Add more pairs to process several photos in one go.</p>
|
||||
|
||||
@@ -40,18 +41,35 @@
|
||||
|
||||
<button type="button" class="add-duo" id="add-duo">+ Add another pair</button>
|
||||
|
||||
<label class="checkbox-row">
|
||||
<input type="checkbox" name="ignore_ig_resolution">
|
||||
Process anyway if the resolution doesn't match Instagram's feed sizes
|
||||
</label>
|
||||
|
||||
<button class="run" type="submit">Assemble the HDR</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<p class="footnote">
|
||||
Each pair's files must have identical dimensions, matching exactly one of Instagram's feed
|
||||
resolutions: <strong>1080x1080</strong> (1:1), <strong>1080x1350</strong> (4:5), or
|
||||
<strong>1080x566</strong> (1.91:1). Assembling more than one pair downloads as a <code>.zip</code>.
|
||||
HDR can be a regular gain-map JPEG or Lightroom's 32-bit float linear HDR TIFF export; a
|
||||
TIFF HDR file gives a more precise result than the JPEG gain-map route.
|
||||
Each pair's files must have identical dimensions. By default that must also match one of
|
||||
Instagram's feed resolutions exactly: <strong>1080x1080</strong> (1:1),
|
||||
<strong>1080x1350</strong> (4:5), or <strong>1080x566</strong> (1.91:1); check the box above
|
||||
to skip that check for results meant for somewhere other than Instagram. Assembling more
|
||||
than one pair downloads as a <code>.zip</code>. HDR can be a regular gain-map JPEG or
|
||||
Lightroom's 32-bit float linear HDR TIFF export; a TIFF HDR file gives a more precise result
|
||||
than the JPEG gain-map route.
|
||||
</p>
|
||||
<p class="version">Instagram HDR Assembler v{{ app_version }}</p>
|
||||
<p class="version">Instameex v{{ app_version }}</p>
|
||||
<div class="repo-links">
|
||||
<a href="https://git.djeex.fr/Djeex/instameex" target="_blank" rel="noopener">
|
||||
<span class="icon"><img src="{{ url_for('static', filename='img/gitea.svg') }}" alt=""></span>
|
||||
Gitea
|
||||
</a>
|
||||
<a href="https://github.com/Djeex/instameex" target="_blank" rel="noopener">
|
||||
<span class="icon"><img src="{{ url_for('static', filename='img/github.svg') }}" alt=""></span>
|
||||
GitHub
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
@@ -3,8 +3,9 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Instagram HDR Assembler — Result</title>
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
||||
<title>Instameex - Result</title>
|
||||
<link rel="icon" type="image/svg+xml" href="{{ url_for('static', filename='img/logo.svg') }}">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrap">
|
||||
@@ -43,7 +44,17 @@
|
||||
Remember to upload from a desktop browser (up-to-date Chrome) afterwards, choosing
|
||||
<code>Original</code> as the crop — not the default 1:1 crop.
|
||||
</p>
|
||||
<p class="version">Instagram HDR Assembler v{{ app_version }}</p>
|
||||
<p class="version">Instameex v{{ app_version }}</p>
|
||||
<div class="repo-links">
|
||||
<a href="https://git.djeex.fr/Djeex/instameex" target="_blank" rel="noopener">
|
||||
<span class="icon"><img src="{{ url_for('static', filename='img/gitea.svg') }}" alt=""></span>
|
||||
Gitea
|
||||
</a>
|
||||
<a href="https://github.com/Djeex/instameex" target="_blank" rel="noopener">
|
||||
<span class="icon"><img src="{{ url_for('static', filename='img/github.svg') }}" alt=""></span>
|
||||
GitHub
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
@@ -0,0 +1,28 @@
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
sys.path.insert(0, str(ROOT / "src" / "script"))
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def jobs_dir(tmp_path, monkeypatch):
|
||||
from app import jobs
|
||||
|
||||
monkeypatch.setattr(jobs, "JOBS_DIR", tmp_path / "jobs")
|
||||
jobs.JOBS.clear()
|
||||
yield tmp_path / "jobs"
|
||||
jobs.JOBS.clear()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def client(jobs_dir, monkeypatch):
|
||||
from app import create_app, jobs
|
||||
|
||||
monkeypatch.setattr(jobs, "start_reaper", lambda: None)
|
||||
app = create_app()
|
||||
app.config["TESTING"] = True
|
||||
return app.test_client()
|
||||
@@ -0,0 +1,207 @@
|
||||
import subprocess
|
||||
from types import SimpleNamespace
|
||||
|
||||
import numpy as np
|
||||
import pytest
|
||||
import tifffile
|
||||
from PIL import Image
|
||||
|
||||
from app import assembler
|
||||
|
||||
|
||||
def cp(returncode=0, stdout="", stderr=""):
|
||||
return SimpleNamespace(returncode=returncode, stdout=stdout, stderr=stderr)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def tools(monkeypatch):
|
||||
monkeypatch.setattr(assembler.shutil, "which", lambda t: f"/usr/bin/{t}")
|
||||
|
||||
|
||||
def test_check_dependencies(monkeypatch):
|
||||
monkeypatch.setattr(assembler.shutil, "which", lambda t: None)
|
||||
assert assembler.check_dependencies() == ["ultrahdr_app", "exiftool"]
|
||||
monkeypatch.setattr(assembler.shutil, "which", lambda t: "/x" if t == "exiftool" else None)
|
||||
assert assembler.check_dependencies() == ["ultrahdr_app"]
|
||||
monkeypatch.setattr(assembler.shutil, "which", lambda t: "/x")
|
||||
assert assembler.check_dependencies() == []
|
||||
|
||||
|
||||
@pytest.mark.parametrize("desc,code", [
|
||||
("Display P3", "1"), ("Rec2020 PQ", "2"), ("ITU-R BT.2100", "2"),
|
||||
("sRGB IEC61966-2.1", "0"), ("", "0"),
|
||||
])
|
||||
def test_detect_gamut(monkeypatch, tmp_path, desc, code):
|
||||
monkeypatch.setattr(assembler.subprocess, "run", lambda *a, **k: cp(stdout=desc + "\n"))
|
||||
assert assembler._detect_gamut(tmp_path / "x.jpg") == code
|
||||
|
||||
|
||||
def test_decode_hdr_intent_error(monkeypatch, tools, tmp_path):
|
||||
monkeypatch.setattr(assembler.subprocess, "run", lambda *a, **k: cp(1, stderr="bad file"))
|
||||
with pytest.raises(assembler.AssemblyError, match="bad file"):
|
||||
assembler._decode_hdr_intent(tmp_path / "h.jpg", tmp_path / "o.raw")
|
||||
|
||||
|
||||
def test_encode_without_and_with_max_boost(monkeypatch, tools, tmp_path):
|
||||
calls = []
|
||||
monkeypatch.setattr(assembler.subprocess, "run", lambda args, **k: calls.append(args) or cp())
|
||||
assembler._encode(tmp_path / "r", "0", tmp_path / "s", "0", 10, 20, tmp_path / "o")
|
||||
assert "-K" not in calls[0] and calls[0][calls[0].index("-t") + 1] == "1"
|
||||
|
||||
assembler._encode(tmp_path / "r", "1", tmp_path / "s", "0", 10, 20, tmp_path / "o", max_boost=4.0)
|
||||
args = calls[1]
|
||||
assert args[args.index("-K") + 1] == "4.0"
|
||||
assert args[args.index("-k") + 1] == "1" # floor never below 1
|
||||
assert args[args.index("-L") + 1] == str(4.0 * 203)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("boost,nits", [(0.1, 203), (100.0, 10000)])
|
||||
def test_encode_target_nits_clamped(monkeypatch, tools, tmp_path, boost, nits):
|
||||
calls = []
|
||||
monkeypatch.setattr(assembler.subprocess, "run", lambda args, **k: calls.append(args) or cp())
|
||||
assembler._encode(tmp_path / "r", "0", tmp_path / "s", "0", 1, 1, tmp_path / "o", max_boost=boost)
|
||||
assert calls[0][calls[0].index("-L") + 1] == str(nits)
|
||||
|
||||
|
||||
def test_encode_failure(monkeypatch, tools, tmp_path):
|
||||
monkeypatch.setattr(assembler.subprocess, "run", lambda *a, **k: cp(1, stderr="nope"))
|
||||
with pytest.raises(assembler.AssemblyError, match="nope"):
|
||||
assembler._encode(tmp_path / "r", "0", tmp_path / "s", "0", 1, 1, tmp_path / "o")
|
||||
|
||||
|
||||
def test_to_4_2_0_keeps_icc_profile(tmp_path):
|
||||
src, dest = tmp_path / "s.jpg", tmp_path / "d.jpg"
|
||||
Image.new("RGB", (16, 16), "red").save(src, "JPEG", icc_profile=b"ICCDATA")
|
||||
assembler._to_4_2_0(src, dest)
|
||||
with Image.open(dest) as img:
|
||||
assert img.info.get("icc_profile") == b"ICCDATA"
|
||||
assert img.size == (16, 16)
|
||||
|
||||
|
||||
def test_to_4_2_0_without_icc(tmp_path):
|
||||
src, dest = tmp_path / "s.jpg", tmp_path / "d.jpg"
|
||||
Image.new("RGB", (8, 8)).save(src, "JPEG")
|
||||
assembler._to_4_2_0(src, dest)
|
||||
assert dest.exists()
|
||||
|
||||
|
||||
def test_tiff_to_hdr_raw(tmp_path):
|
||||
tiff = tmp_path / "h.tif"
|
||||
data = np.full((2, 3, 3), 2.0, dtype=np.float32)
|
||||
data[0, 0] = -1.0 # negative values must be clipped
|
||||
tifffile.imwrite(tiff, data)
|
||||
dest = tmp_path / "out.raw"
|
||||
w, h, linear = assembler._tiff_to_hdr_raw(tiff, dest)
|
||||
assert (w, h) == (3, 2)
|
||||
assert linear[0, 0, 0] == 0.0
|
||||
assert linear[1, 1, 0] == pytest.approx(2.0 ** assembler._HLG_SYSTEM_GAMMA)
|
||||
assert dest.stat().st_size == 2 * 3 * 4 * 2 # RGBA half floats
|
||||
|
||||
|
||||
def test_jpeg_to_linear_range(tmp_path):
|
||||
p = tmp_path / "w.jpg"
|
||||
Image.new("RGB", (4, 4), "white").save(p, "JPEG")
|
||||
lin = assembler._jpeg_to_linear(p)
|
||||
assert lin.shape == (4, 4, 3) and lin.max() == pytest.approx(1.0, abs=0.02)
|
||||
|
||||
|
||||
def test_tiff_max_boost_ignores_near_black_and_picks_32nd(tmp_path):
|
||||
sdr = tmp_path / "s.jpg"
|
||||
Image.new("RGB", (16, 16), (128, 128, 128)).save(sdr, "JPEG", quality=100)
|
||||
sdr_lin = assembler._jpeg_to_linear(sdr)
|
||||
hdr = sdr_lin * 3.0
|
||||
assert assembler._tiff_max_boost(hdr, sdr) == pytest.approx(3.0, rel=0.01)
|
||||
hdr[0, 0] = 1000.0 # a lone spike must not set the boost
|
||||
assert assembler._tiff_max_boost(hdr, sdr) == pytest.approx(3.0, rel=0.01)
|
||||
|
||||
|
||||
def test_tiff_max_boost_all_black_image_has_no_signal(tmp_path):
|
||||
sdr = tmp_path / "s.jpg"
|
||||
Image.new("RGB", (8, 8), "black").save(sdr, "JPEG")
|
||||
assert assembler._tiff_max_boost(np.ones((8, 8, 3), dtype=np.float32), sdr) == 1.0
|
||||
|
||||
|
||||
def test_tiff_max_boost_fewer_than_32_pixels(tmp_path):
|
||||
sdr = tmp_path / "s.jpg"
|
||||
Image.new("RGB", (2, 2), (128, 128, 128)).save(sdr, "JPEG", quality=100)
|
||||
hdr = assembler._jpeg_to_linear(sdr) * 2.0
|
||||
assert assembler._tiff_max_boost(hdr, sdr) == pytest.approx(2.0, rel=0.01)
|
||||
|
||||
|
||||
def test_probe_hdr_capacity(monkeypatch, tools, tmp_path):
|
||||
out = "foo\n --hdrCapacityMax 3.5\n"
|
||||
monkeypatch.setattr(assembler.subprocess, "run", lambda *a, **k: cp(stdout=out))
|
||||
assert assembler._probe_hdr_capacity(tmp_path / "x") == 3.5
|
||||
monkeypatch.setattr(assembler.subprocess, "run", lambda *a, **k: cp(stdout="nothing"))
|
||||
with pytest.raises(assembler.AssemblyError):
|
||||
assembler._probe_hdr_capacity(tmp_path / "x")
|
||||
|
||||
|
||||
def fake_exiftool(min_value=None, extract_ok=True, report_stdout=None):
|
||||
import json
|
||||
|
||||
def run(args, **k):
|
||||
if "-MPImage2" in args:
|
||||
return cp(0 if extract_ok else 1, stdout=b"data" if extract_ok else b"")
|
||||
stdout = report_stdout
|
||||
if stdout is None:
|
||||
meta = {"XMP-hdrgm:Version": "1.0", "Other:Tag": "x"}
|
||||
if min_value is not None:
|
||||
meta["XMP-hdrgm:GainMapMin"] = min_value
|
||||
stdout = json.dumps([meta])
|
||||
return cp(stdout=stdout)
|
||||
|
||||
return run
|
||||
|
||||
|
||||
@pytest.mark.parametrize("value,negative", [(-0.5, True), (0, False), (1, False), (None, False)])
|
||||
def test_validate_output_gain_map_min(monkeypatch, tmp_path, value, negative):
|
||||
monkeypatch.setattr(assembler.subprocess, "run", fake_exiftool(min_value=value))
|
||||
log = []
|
||||
assert assembler._validate_output(tmp_path / "o.jpg", log) is negative
|
||||
assert any("Validation report" in line for line in log)
|
||||
assert any("WARNING" in line for line in log) is negative
|
||||
assert not any("Other:Tag" in line for line in log) # non-hdrgm tags filtered
|
||||
|
||||
|
||||
@pytest.mark.parametrize("kwargs", [
|
||||
{"extract_ok": False}, {"report_stdout": "not json"}, {"report_stdout": "[]"},
|
||||
])
|
||||
def test_validate_output_unreadable_metadata(monkeypatch, tmp_path, kwargs):
|
||||
monkeypatch.setattr(assembler.subprocess, "run", fake_exiftool(**kwargs))
|
||||
log = []
|
||||
assert assembler._validate_output(tmp_path / "o.jpg", log) is False
|
||||
assert log == []
|
||||
|
||||
|
||||
def test_run_missing_tools(monkeypatch, tmp_path):
|
||||
monkeypatch.setattr(assembler.shutil, "which", lambda t: None)
|
||||
ok, log, warn = assembler.run(tmp_path / "s.jpg", tmp_path / "h.jpg", tmp_path / "o.jpg")
|
||||
assert (ok, warn) == (False, False) and "ultrahdr_app" in log
|
||||
|
||||
|
||||
@pytest.mark.parametrize("suffix,target", [
|
||||
(".jpg", "_assemble_from_jpeg"), (".JPEG", "_assemble_from_jpeg"),
|
||||
(".tif", "_assemble_from_tiff_hdr"), (".TIFF", "_assemble_from_tiff_hdr"),
|
||||
])
|
||||
def test_run_dispatch_by_hdr_extension(monkeypatch, tools, tmp_path, suffix, target):
|
||||
called = []
|
||||
for name in ("_assemble_from_jpeg", "_assemble_from_tiff_hdr"):
|
||||
monkeypatch.setattr(assembler, name, lambda *a, n=name: called.append(n))
|
||||
monkeypatch.setattr(assembler, "_validate_output", lambda *a: True)
|
||||
ok, log, warn = assembler.run(tmp_path / "s.jpg", tmp_path / f"h{suffix}", tmp_path / "o.jpg")
|
||||
assert called == [target] and ok is True and warn is True and "Done!" in log
|
||||
|
||||
|
||||
@pytest.mark.parametrize("exc", [
|
||||
assembler.AssemblyError("boom"),
|
||||
subprocess.CalledProcessError(1, "x"),
|
||||
subprocess.TimeoutExpired("x", 1),
|
||||
])
|
||||
def test_run_pipeline_errors_are_reported(monkeypatch, tools, tmp_path, exc):
|
||||
def fail(*a):
|
||||
raise exc
|
||||
|
||||
monkeypatch.setattr(assembler, "_assemble_from_jpeg", fail)
|
||||
ok, log, warn = assembler.run(tmp_path / "s.jpg", tmp_path / "h.jpg", tmp_path / "o.jpg")
|
||||
assert (ok, warn) == (False, False) and log.startswith("Error:")
|
||||
@@ -0,0 +1,79 @@
|
||||
import time
|
||||
|
||||
import pytest
|
||||
|
||||
from app import jobs
|
||||
|
||||
|
||||
def test_new_job_dir_creates_directory(jobs_dir):
|
||||
d = jobs.new_job_dir("abc")
|
||||
assert d == jobs_dir / "abc" and d.is_dir()
|
||||
assert jobs.new_job_dir("abc") == d # idempotent
|
||||
|
||||
|
||||
def test_register_get_unknown(jobs_dir):
|
||||
assert jobs.get("nope") is None
|
||||
jobs.register("j1", items=[1])
|
||||
job = jobs.get("j1")
|
||||
assert job["items"] == [1] and "last_seen" in job
|
||||
|
||||
|
||||
def test_touch_updates_and_ignores_unknown(jobs_dir):
|
||||
jobs.register("j1")
|
||||
jobs.JOBS["j1"]["last_seen"] = 0
|
||||
jobs.touch("j1")
|
||||
assert jobs.JOBS["j1"]["last_seen"] > 0
|
||||
jobs.touch("unknown") # must not raise
|
||||
assert "unknown" not in jobs.JOBS
|
||||
|
||||
|
||||
def test_cleanup_removes_registry_and_dir(jobs_dir):
|
||||
d = jobs.new_job_dir("j1")
|
||||
(d / "f.txt").write_text("x")
|
||||
jobs.register("j1")
|
||||
jobs.cleanup("j1")
|
||||
assert jobs.get("j1") is None and not d.exists()
|
||||
|
||||
|
||||
def test_cleanup_unknown_job_is_noop(jobs_dir):
|
||||
jobs.reset_jobs_dir()
|
||||
jobs.cleanup("ghost")
|
||||
|
||||
|
||||
def test_reset_jobs_dir_wipes_leftovers(jobs_dir):
|
||||
jobs.new_job_dir("old")
|
||||
jobs.reset_jobs_dir()
|
||||
assert jobs_dir.is_dir() and list(jobs_dir.iterdir()) == []
|
||||
|
||||
|
||||
def test_reap_removes_only_stale_jobs(jobs_dir, monkeypatch):
|
||||
jobs.new_job_dir("stale")
|
||||
jobs.new_job_dir("fresh")
|
||||
jobs.register("stale")
|
||||
jobs.register("fresh")
|
||||
jobs.JOBS["stale"]["last_seen"] = time.time() - 1000
|
||||
|
||||
def stop(_):
|
||||
if stop.called:
|
||||
raise StopIteration
|
||||
stop.called = True
|
||||
|
||||
stop.called = False
|
||||
monkeypatch.setattr(jobs.time, "sleep", stop)
|
||||
with pytest.raises(StopIteration):
|
||||
jobs._reap_stale_jobs()
|
||||
assert "stale" not in jobs.JOBS and not (jobs_dir / "stale").exists()
|
||||
assert "fresh" in jobs.JOBS and (jobs_dir / "fresh").exists()
|
||||
|
||||
|
||||
def test_reap_with_no_jobs(jobs_dir, monkeypatch):
|
||||
calls = []
|
||||
|
||||
def stop(_):
|
||||
if calls:
|
||||
raise StopIteration
|
||||
calls.append(1)
|
||||
|
||||
monkeypatch.setattr(jobs.time, "sleep", stop)
|
||||
with pytest.raises(StopIteration):
|
||||
jobs._reap_stale_jobs()
|
||||
@@ -0,0 +1,147 @@
|
||||
import io
|
||||
import zipfile
|
||||
|
||||
import pytest
|
||||
from PIL import Image
|
||||
|
||||
from app import assembler, jobs
|
||||
|
||||
|
||||
def jpeg_bytes(size=(1080, 1080)):
|
||||
buf = io.BytesIO()
|
||||
Image.new("RGB", size, "gray").save(buf, "JPEG")
|
||||
return buf.getvalue()
|
||||
|
||||
|
||||
def pair(name="a", sdr_name=None, hdr_name=None, size=(1080, 1080)):
|
||||
return (
|
||||
(io.BytesIO(jpeg_bytes(size)), sdr_name or f"{name}_sdr.jpg"),
|
||||
(io.BytesIO(jpeg_bytes(size)), hdr_name or f"{name}_hdr.jpg"),
|
||||
)
|
||||
|
||||
|
||||
def post(client, pairs):
|
||||
data = {"sdr[]": [p[0] for p in pairs], "hdr[]": [p[1] for p in pairs]}
|
||||
return client.post("/convert", data=data, content_type="multipart/form-data")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def fake_run(monkeypatch):
|
||||
def run(sdr_path, hdr_path, out_path):
|
||||
out_path.write_bytes(b"OUT:" + out_path.name.encode())
|
||||
return True, "ok", False
|
||||
|
||||
monkeypatch.setattr(assembler, "run", run)
|
||||
|
||||
|
||||
def job_id_from(resp):
|
||||
return resp.headers["Location"].rstrip("/").split("/")[-1]
|
||||
|
||||
|
||||
def test_index(client):
|
||||
assert client.get("/").status_code == 200
|
||||
|
||||
|
||||
def test_convert_without_files(client):
|
||||
resp = client.post("/convert", data={}, content_type="multipart/form-data")
|
||||
assert resp.status_code == 400 and b"at least one" in resp.data
|
||||
|
||||
|
||||
def test_convert_unbalanced_pairs(client):
|
||||
data = {"sdr[]": [(io.BytesIO(jpeg_bytes()), "a.jpg")], "hdr[]": []}
|
||||
resp = client.post("/convert", data=data, content_type="multipart/form-data")
|
||||
assert resp.status_code == 400
|
||||
|
||||
|
||||
def test_convert_success_single(client, fake_run):
|
||||
resp = post(client, [pair()])
|
||||
assert resp.status_code == 302
|
||||
jid = job_id_from(resp)
|
||||
page = client.get(f"/result/{jid}")
|
||||
assert page.status_code == 200 and b"JPEG assembled" in page.data
|
||||
dl = client.get(f"/download/{jid}")
|
||||
assert dl.status_code == 200
|
||||
assert dl.headers["Content-Disposition"].endswith("instagram_hdr_output.jpg")
|
||||
assert dl.data.startswith(b"OUT:")
|
||||
|
||||
|
||||
def test_convert_multiple_downloads_zip(client, fake_run):
|
||||
jid = job_id_from(post(client, [pair("a"), pair("b"), pair("c")]))
|
||||
assert b"All 3 assembled" in client.get(f"/result/{jid}").data
|
||||
dl = client.get(f"/download/{jid}")
|
||||
assert dl.mimetype == "application/zip"
|
||||
with zipfile.ZipFile(io.BytesIO(dl.data)) as zf:
|
||||
assert zf.namelist() == [f"instagram_hdr_output_{i}.jpg" for i in (1, 2, 3)]
|
||||
|
||||
|
||||
def test_partial_failure_download_only_successes(client, fake_run):
|
||||
bad = pair("b", sdr_name="b.png")
|
||||
jid = job_id_from(post(client, [pair("a"), bad]))
|
||||
assert b"1/2 assembled" in client.get(f"/result/{jid}").data
|
||||
dl = client.get(f"/download/{jid}")
|
||||
assert dl.mimetype != "application/zip" # a single success is sent as a plain JPEG
|
||||
|
||||
|
||||
def test_all_failed(client, fake_run):
|
||||
jid = job_id_from(post(client, [pair(sdr_name="x.png")]))
|
||||
assert b"Conversion failed" in client.get(f"/result/{jid}").data
|
||||
assert client.get(f"/download/{jid}").status_code == 404
|
||||
|
||||
|
||||
def test_bad_hdr_extension_reported(client, fake_run):
|
||||
jid = job_id_from(post(client, [pair(hdr_name="h.png")]))
|
||||
assert jobs.get(jid)["items"][0]["success"] is False
|
||||
assert "HDR file" in jobs.get(jid)["items"][0]["log"]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("sdr_name,hdr_name", [("", "h.jpg"), ("s.jpg", ""), ("", "")])
|
||||
def test_empty_filename_reported(tmp_path, sdr_name, hdr_name):
|
||||
from types import SimpleNamespace
|
||||
|
||||
from app.routes import _process_pair
|
||||
|
||||
item = _process_pair(tmp_path, 1, SimpleNamespace(filename=sdr_name),
|
||||
SimpleNamespace(filename=hdr_name))
|
||||
assert item["success"] is False and "Missing" in item["log"]
|
||||
|
||||
|
||||
def test_resolution_rejected_and_inputs_removed(client, fake_run, jobs_dir):
|
||||
jid = job_id_from(post(client, [pair(size=(100, 100))]))
|
||||
item = jobs.get(jid)["items"][0]
|
||||
assert not item["success"] and "Instagram requires" in item["log"]
|
||||
assert list((jobs_dir / jid).iterdir()) == []
|
||||
|
||||
|
||||
def test_ignore_ig_resolution_flag(client, fake_run):
|
||||
pairs = [pair(size=(100, 100))]
|
||||
data = {"sdr[]": [pairs[0][0]], "hdr[]": [pairs[0][1]], "ignore_ig_resolution": "on"}
|
||||
resp = client.post("/convert", data=data, content_type="multipart/form-data")
|
||||
assert jobs.get(job_id_from(resp))["items"][0]["success"] is True
|
||||
|
||||
|
||||
def test_assembler_failure_has_no_output(client, monkeypatch):
|
||||
monkeypatch.setattr(assembler, "run", lambda *a: (False, "boom", False))
|
||||
jid = job_id_from(post(client, [pair()]))
|
||||
item = jobs.get(jid)["items"][0]
|
||||
assert item["success"] is False and item["output"] is None
|
||||
assert client.get(f"/download/{jid}").status_code == 404
|
||||
|
||||
|
||||
def test_unknown_job_404(client):
|
||||
assert client.get("/result/nope").status_code == 404
|
||||
assert client.get("/download/nope").status_code == 404
|
||||
|
||||
|
||||
def test_heartbeat(client):
|
||||
assert client.post("/heartbeat/unknown").status_code == 204
|
||||
jobs.register("j1")
|
||||
jobs.JOBS["j1"]["last_seen"] = 0
|
||||
assert client.post("/heartbeat/j1").status_code == 204
|
||||
assert jobs.JOBS["j1"]["last_seen"] > 0
|
||||
|
||||
|
||||
def test_too_large(client, monkeypatch):
|
||||
client.application.config["MAX_CONTENT_LENGTH"] = 10
|
||||
resp = client.post("/convert", data={"sdr[]": (io.BytesIO(b"x" * 100), "a.jpg")},
|
||||
content_type="multipart/form-data")
|
||||
assert resp.status_code == 413 and b"too large" in resp.data
|
||||
@@ -0,0 +1,106 @@
|
||||
import numpy as np
|
||||
import pytest
|
||||
import tifffile
|
||||
from PIL import Image
|
||||
|
||||
from app import validation
|
||||
|
||||
|
||||
def make_jpeg(path, size):
|
||||
Image.new("RGB", size, "gray").save(path, "JPEG")
|
||||
return path
|
||||
|
||||
|
||||
def make_tiff(path, size):
|
||||
tifffile.imwrite(path, np.zeros((size[1], size[0], 3), dtype=np.float32))
|
||||
return path
|
||||
|
||||
|
||||
@pytest.mark.parametrize("name,expected", [
|
||||
("a.JPG", ".jpg"), ("a.b.tiff", ".tiff"), ("noext", ""), ("", ""),
|
||||
])
|
||||
def test_ext(name, expected):
|
||||
assert validation.ext(name) == expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize("name,expected", [
|
||||
("x.tif", True), ("x.TIFF", True), ("x.jpg", False), ("tif", False),
|
||||
])
|
||||
def test_is_tiff(name, expected):
|
||||
assert validation.is_tiff(name) is expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize("name,ok", [
|
||||
("a.jpg", True), ("a.JPEG", True), ("a.tif", False), ("a.png", False), ("", False),
|
||||
])
|
||||
def test_sdr_ext_error(name, ok):
|
||||
assert (validation.sdr_ext_error(name) is None) is ok
|
||||
|
||||
|
||||
@pytest.mark.parametrize("name,ok", [
|
||||
("a.jpg", True), ("a.jpeg", True), ("a.tif", True), ("a.TIFF", True),
|
||||
("a.png", False), ("a.avif", False), ("", False),
|
||||
])
|
||||
def test_hdr_ext_error(name, ok):
|
||||
assert (validation.hdr_ext_error(name) is None) is ok
|
||||
|
||||
|
||||
def test_probe_dimensions_jpeg_and_tiff(tmp_path):
|
||||
assert validation.probe_dimensions(make_jpeg(tmp_path / "a.jpg", (30, 20))) == (30, 20)
|
||||
assert validation.probe_dimensions(make_tiff(tmp_path / "a.tif", (30, 20))) == (30, 20)
|
||||
|
||||
|
||||
def test_probe_dimensions_corrupt(tmp_path):
|
||||
bad_jpg = tmp_path / "bad.jpg"
|
||||
bad_jpg.write_bytes(b"not an image")
|
||||
bad_tif = tmp_path / "bad.tif"
|
||||
bad_tif.write_bytes(b"not a tiff")
|
||||
with pytest.raises(ValueError, match="image dimensions"):
|
||||
validation.probe_dimensions(bad_jpg)
|
||||
with pytest.raises(ValueError, match="TIFF dimensions"):
|
||||
validation.probe_dimensions(bad_tif)
|
||||
|
||||
|
||||
def test_probe_dimensions_missing_file(tmp_path):
|
||||
with pytest.raises(ValueError):
|
||||
validation.probe_dimensions(tmp_path / "missing.jpg")
|
||||
|
||||
|
||||
@pytest.mark.parametrize("size", [(1080, 1080), (1080, 1350), (1080, 566)])
|
||||
def test_resolution_ok_for_each_instagram_format(tmp_path, size):
|
||||
sdr = make_jpeg(tmp_path / "s.jpg", size)
|
||||
hdr = make_jpeg(tmp_path / "h.jpg", size)
|
||||
assert validation.instagram_resolution_error(sdr, hdr) is None
|
||||
|
||||
|
||||
def test_resolution_ok_with_tiff_hdr(tmp_path):
|
||||
sdr = make_jpeg(tmp_path / "s.jpg", (1080, 1080))
|
||||
hdr = make_tiff(tmp_path / "h.tif", (1080, 1080))
|
||||
assert validation.instagram_resolution_error(sdr, hdr) is None
|
||||
|
||||
|
||||
def test_resolution_mismatch_always_rejected(tmp_path):
|
||||
sdr = make_jpeg(tmp_path / "s.jpg", (1080, 1080))
|
||||
hdr = make_jpeg(tmp_path / "h.jpg", (1080, 1350))
|
||||
for ignore in (False, True):
|
||||
assert "identical" in validation.instagram_resolution_error(sdr, hdr, ignore)
|
||||
|
||||
|
||||
def test_resolution_not_instagram(tmp_path):
|
||||
sdr = make_jpeg(tmp_path / "s.jpg", (100, 100))
|
||||
hdr = make_jpeg(tmp_path / "h.jpg", (100, 100))
|
||||
assert "Instagram requires" in validation.instagram_resolution_error(sdr, hdr)
|
||||
assert validation.instagram_resolution_error(sdr, hdr, ignore_ig_resolution=True) is None
|
||||
|
||||
|
||||
def test_resolution_swapped_dimensions_rejected(tmp_path):
|
||||
sdr = make_jpeg(tmp_path / "s.jpg", (1350, 1080))
|
||||
hdr = make_jpeg(tmp_path / "h.jpg", (1350, 1080))
|
||||
assert validation.instagram_resolution_error(sdr, hdr) is not None
|
||||
|
||||
|
||||
def test_resolution_unreadable_file(tmp_path):
|
||||
sdr = make_jpeg(tmp_path / "s.jpg", (1080, 1080))
|
||||
bad = tmp_path / "h.jpg"
|
||||
bad.write_bytes(b"")
|
||||
assert "Could not validate" in validation.instagram_resolution_error(sdr, bad)
|
||||