Repository navigation
Pictures: compress pictures to a target resolution - #513
Merged
Merged
Conversation
Picture Format › Adjust gains Compress Pictures, with PowerPoint's options: HD 330, Print 220, Web 150 or E-mail 96 ppi, apply to the selected pictures or all, and delete cropped areas. The new picture.compress command downsamples each PNG, JPEG, BMP, TIFF or WebP picture to the pixels its shown size needs at that resolution (JPEG stays JPEG at quality 85, the rest become PNG), cuts away cropped areas when asked, and only replaces a picture when the result is smaller or a crop was removed. Originals nothing else uses are dropped so the saved file shrinks; one shared with a picture that wasn't compressed stays. One undo step restores everything. Co-authored-by: Cursor <cursoragent@cursor.com>
h-a-n-a-s-h-i
pushed a commit
that referenced
this pull request
Oct 14, 2026
picture.compress decided which originals were still in use by scanning JSON keys, which missed artistic-effect originals (and the embedded-font shape it assumed no longer exists), so compressing a picture whose bytes were also another picture's artistic original deleted media still in use. It now uses the engine's typed media walker (media_refs::presentation_media). Decoding is capped: the header's size is read first and pictures over 64 MP are left alone, and the decoder runs with image::Limits (512 MiB allocation), instead of decoding up to 400 MP before checking. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
h-a-n-a-s-h-i
pushed a commit
that referenced
this pull request
Oct 14, 2026
Member
|
Thank you for this contribution, @NikitkaRa! It has landed on If you haven't already, please come join us on Discord: https://discord.gg/artcraft |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
picture.compress {ppi?: 330|220|150|96 (default 220), deleteCropped?: bool (default true), all?: bool, ids?}→{pictures, before, after}..deckcraftand.pptxfiles really shrink. One still used by a picture that wasn't compressed stays. One undo step restores everything.No issue tracks this; it's a docs/gaps.md item.
Test plan
cargo xtask ci(fmt, clippy, test, assets, layers, wasm)cmd::compress):compress_pictures_shrinks_the_file_and_keeps_shared_originals:all: truethen compresses bothdeckcraft-cli run --in 45545_Comment.pptx --cmd 'picture.compress={"ppi":96,"all":true}': a third-party deck whose pictures are already small (a PNG and a WMF) is left as it was