Skip to content

Add RGBnoQUANT option to PS_COLOR_MODEL - #9172

Merged
joa-quim merged 1 commit into
GenericMappingTools:masterfrom
RyanHaotianPang:coderyan/rgbnoquant
Sep 1, 2026
Merged

Add RGBnoQUANT option to PS_COLOR_MODEL#9172
joa-quim merged 1 commit into
GenericMappingTools:masterfrom
RyanHaotianPang:coderyan/rgbnoquant

Conversation

@RyanHaotianPang

Copy link
Copy Markdown
Contributor

Description of proposed changes

Adds PS_COLOR_MODEL=RGBnoQUANT, an opt-in compatibility setting for
third-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.

RGBnoQUANT keeps the normal RGB color mode for all PostScript colors. Its
only difference is that 24-bit RGB raster images bypass the existing
indexed-color optimization and are emitted through the existing direct
/DeviceRGB output path. Default PS_COLOR_MODEL=RGB output, CPT
interpolation, and grdimage color calculations are unchanged.

The setting is parsed case-insensitively and gmt get PS_COLOR_MODEL reports
the canonical value rgbnoquant.

Fixes #9171

Visual comparison

Tests

  • Added test/postscriptlight/rgbnoquant.sh with a four-color RGB PPM image.
    It verifies that normal RGB still emits /Indexed /DeviceRGB with reduced
    bits, while mixed-case RGBnoQUANT round-trips through gmt get, emits
    direct /DeviceRGB, and contains no indexed color space. It also checks
    that switching back to RGB restores indexed output.
  • ctest --test-dir build --output-on-failure -R 'test/postscriptlight/rgbnoquant\\.sh' (1/1 passed).
  • Ghostscript renders of the normal-RGB and RGBnoQUANT regression outputs were
    pixel-identical.
  • Manually verified the modified PDF resolves the Illustrator color issue.
41980b63fd58ea5ba58434400f064c2b

Reminders

  • Make sure that your code follows our style. Use the other functions/files as a basis.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Describe changes to function behavior and arguments in a comment below the function declaration.
  • If adding new functionality, add a detailed description to the documentation and/or an example.

@joa-quim joa-quim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR, that looks good. I tested it locally and no side effects were detected.

@joa-quim
joa-quim merged commit 31d9263 into GenericMappingTools:master Sep 1, 2026
11 of 14 checks passed
@Esteban82

Copy link
Copy Markdown
Member

Hi @RyanHaotianPang, thanks for the contribution! Did you use any AI assistant to help write this PR? If so, which one?

@Esteban82 Esteban82 added enhancement Improving an existing feature add-changelog Add PR to the changelog labels Sep 1, 2026
@RyanHaotianPang

Copy link
Copy Markdown
Contributor Author

Hi, thanks! @Esteban82 I used OpenAI Codex to assist with the implementation and testing.

@Esteban82 Esteban82 added the AI-assisted All (or most) of the code was written by Artificial Intelligence. label Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add-changelog Add PR to the changelog AI-assisted All (or most) of the code was written by Artificial Intelligence. enhancement Improving an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compatibility issue with low-bit-depth indexed RGB images in Adobe Illustrator

3 participants