Add RGBnoQUANT option to PS_COLOR_MODEL - #9172
Merged
joa-quim merged 1 commit intoSep 1, 2026
Merged
Conversation
joa-quim
approved these changes
Sep 1, 2026
joa-quim
left a comment
Member
There was a problem hiding this comment.
Thanks for this PR, that looks good. I tested it locally and no side effects were detected.
Member
|
Hi @RyanHaotianPang, thanks for the contribution! Did you use any AI assistant to help write this PR? If so, which one? |
Contributor
Author
|
Hi, thanks! @Esteban82 I used OpenAI Codex to assist with the implementation and testing. |
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.
Description of proposed changes
Adds
PS_COLOR_MODEL=RGBnoQUANT, an opt-in compatibility setting forthird-party PostScript/PDF editors that incorrectly interpret low-bit-depth
indexed RGB raster images. It addresses #9171, where Adobe Illustrator may
change raster colors when opening or embedding a GMT-generated PDF.
RGBnoQUANTkeeps the normal RGB color mode for all PostScript colors. Itsonly difference is that 24-bit RGB raster images bypass the existing
indexed-color optimization and are emitted through the existing direct
/DeviceRGBoutput path. DefaultPS_COLOR_MODEL=RGBoutput, CPTinterpolation, and
grdimagecolor calculations are unchanged.The setting is parsed case-insensitively and
gmt get PS_COLOR_MODELreportsthe canonical value
rgbnoquant.Fixes #9171
Visual comparison
Tests
test/postscriptlight/rgbnoquant.shwith a four-color RGB PPM image.It verifies that normal RGB still emits
/Indexed /DeviceRGBwith reducedbits, while mixed-case
RGBnoQUANTround-trips throughgmt get, emitsdirect
/DeviceRGB, and contains no indexed color space. It also checksthat switching back to RGB restores indexed output.
ctest --test-dir build --output-on-failure -R 'test/postscriptlight/rgbnoquant\\.sh'(1/1 passed).pixel-identical.
Reminders