Repository navigation
Support saving PCX images with dpi - #10710
Merged
Merged
Conversation
The PCX header has horizontal and vertical resolution fields, and the reader exposes them as info["dpi"], but saving always wrote 100 dpi. Use the dpi argument when given, rounded to integers like other formats.
radarhere
reviewed
Dec 3, 2026
radarhere
enabled auto-merge (squash)
December 3, 2026 06:10
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.
The PCX header has 16-bit horizontal and vertical resolution fields, and
PcxImagePluginreads them intoinfo["dpi"]. When saving, though, the resolution is hardcoded to 100, soim.save("out.pcx", dpi=(300, 300))reopens with(100, 100).Changes proposed in this pull request:
dpisave argument when it is given, rounded to integers. Without it, 100 dpi is still written, so existing output doesn't change.test_dpitoTests/test_file_pcx.py, covering the default, an explicit value and float rounding.Checks run locally (Linux, Python 3.14):
python3 -m pytest Tests/test_file_pcx.py Tests/test_file_dcx.py: 43 passed.test_dpifails with(100, 100) == (300, 150).pre-commit runon the changed files andmypyon the plugin and test file pass.