mirror of
https://github.com/storytold/photocraft.git
synced 2026-10-24 09:57:08 -06:00
Save As JPEG: JPEG Options dialog (quality 0–12, Baseline / Optimized / Progressive) (FILE-215-19)
Save As and Save a Copy to a JPEG now ask for JPEG Options before writing, as Photoshop does. Re-creates #4330 on current main and folds in the unique parts of #5580 (#5563). - codecs: `JpegFormat` (Baseline, Optimized, Progressive) on `EncodeOptions`. Progressive writes SOF2. Baseline Optimized fits the Huffman tables only at 4:4:4 (Gray, CMYK) or with Progressive: fitted tables make the baseline scans non-interleaved, which zune-jpeg 0.5.15 decodes wrongly with 4:2:0 chroma (zune-image#419), as Save for Web already works around. - engine: a `jpegFormat` save param (file.saveACopy, Batch, Image Processor, Layers to Files and every SaveOpts user; anything but the three names is BadParams before writing) and a shared 0–12 -> 1–100 `jpeg_quality()` that maps NaN/inf to 100. - ui-egui: `jpeg_options_ui` (Quality 0–12 with Low/Medium/High/Maximum presets, Format Options), parked like Targa Options. It starts at the opened JPEG's own quality (`file_encoding`, #4032), else the Export preference; left there, OK writes that quality exactly and the step records no `quality`. `SaveChoices` (Targa bits + JPEG) replaces the bare `tga_bits` through file.save / file.saveAs / app.save, replay and Save a Copy; automation never prompts. `write_answered_save` is shared with Targa Options. `park_at` + `Start` let any save seed the prompt. A File › Save that confirms the document's own flat JPEG is still journalled as a plain `file.save` (#3531). - CLI: `--jpeg-format`. - i18n: five new strings in all 20 catalogs (#4330's duplicate de/es/zh `Low`/`High` rows dropped: main has them since #4008). - Docs: book raster-formats JPEG bullet, control protocol, file-format parity, gaps G10, target-app parity; scorecard FILE-215-19 done. Co-authored-by: SckraT <70698629+SckraT@users.noreply.github.com> Co-authored-by: PierrunoYT <95778421+PierrunoYT@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
SckraT
PierrunoYT
Claude Opus 5.5
parent
3a896a5efc
commit
e647e102f3
@@ -19,6 +19,7 @@ Every route that writes a document to a flat format (Save As, the CLI, MCP `doc_
|
||||
- Formats without transparency (JPEG, Radiance HDR) get the image composited over white, as Export As and Quick Export do; in CMYK, white is no ink.
|
||||
- Formats that can't embed an ICC profile (GIF, BMP, TGA, QOI, ICO, Netpbm/PFM) get RGB documents in another profile (linear light, Display P3, …) converted to sRGB through the colour engine (perceptual intent), since an untagged file is read as sRGB. OpenEXR and Radiance HDR get linear sRGB instead (linear gray for a grayscale OpenEXR), which is how they are tagged when opened.
|
||||
- TGA, as Photoshop's Targa: an RGB Targa is 24 or 32 bits per pixel. Save As and Save a Copy ask (Targa Options, starting at 32 with an alpha channel, else 24); Export As has a Resolution choice (Auto, 24 or 32 bits/pixel); scripts pass `tgaBits` (`--tga-bits` on the CLI). At 32 bits the document's alpha channel is the file's alpha when it has exactly one (spot channels don't count; with several, none is used), and the colours are written exactly, never premultiplied or cleared where the alpha is 0, so a game texture's mask and its colours both survive. Without a usable alpha channel the layers' transparency is the alpha (opaque without any). 24 bits write no alpha, compositing transparency over white. Without a choice: 32 with an alpha channel or transparency, else 24. A 32-bit Targa opens as an opaque Background with its alpha as "Alpha 1", so it round-trips. Grayscale Targas are 8-bit.
|
||||
- JPEG, as Photoshop's JPEG Options: Save As and Save a Copy ask for the Quality on Photoshop's 0–12 scale (with its Low, Medium, High and Maximum presets) and a Format Option: Baseline ("Standard"), Baseline Optimized (Huffman tables fitted to the image) or Progressive. The quality starts at the opened JPEG's own quality, else at the Export preference's JPEG quality; left there, an opened JPEG is written at exactly its own quality. Scripts pass `"quality": 0..12` and `"jpegFormat": "baseline" | "optimized" | "progressive"` (on the CLI, `--quality` on the encoder's 1–100 scale and `--jpeg-format`) and aren't asked; recorded actions replay the answer. The scale maps onto the encoder's 1–100 as `round(q / 12 × 99 + 1)`. RGB JPEGs are written 4:2:0, where Baseline Optimized keeps the standard tables for now (Gray and CMYK, written 4:4:4, get fitted ones). Matte and the file-size preview aren't offered.
|
||||
|
||||
Flat TIFF and JPEG exports of composited CMYK documents convert the RGB composite back through
|
||||
the document's CMYK ICC profile (relative colorimetric with black point compensation) and embed
|
||||
|
||||
Reference in New Issue
Block a user