Skip to content

Fix #8795 gmt image -I inversion - #8837

Merged
seisman merged 2 commits into
GenericMappingTools:masterfrom
ES-Solar:fix-invert-8795-clean
Dec 10, 2025
Merged

seisman merged 2 commits into
GenericMappingTools:masterfrom
ES-Solar:fix-invert-8795-clean

Conversation

@ES-Solar

@ES-Solar ES-Solar commented Dec 9, 2025

Copy link
Copy Markdown
Collaborator

Description of proposed changes

Png bit map images are converted to 24-bit internally and this conversion seemed to be confusing the -I logic. For a 2-color color map image, the logic was adjusted so treat the 2-color color map image as a bitmap image and also support replacing the foreground and background colors.

…8795)

- Detect 2-color (1-bit) images and swap colormap entries when -I is used
- Apply -G color replacements to colormap before expansion to RGB
- Ensures -I option works correctly for 1-bit PNG images

Fixes GenericMappingTools#8795
)

- Tests normal image, inverted image, and inverted with color changes
- Verifies fix for issue GenericMappingTools#8795

@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.

I run the tests locally and this worked, thanks. But for committing, an "original" PS file must be submitted to the DVC otherwise the new test will always fail (and please don't ask me how to. I hate the DVC, it never works for me).

@seisman
seisman merged commit 5e90e1e into GenericMappingTools:master Dec 10, 2025
@seisman

seisman commented Dec 10, 2025

Copy link
Copy Markdown
Member

I can confirm that it works. I'll add the baseline image later.

seisman added a commit that referenced this pull request Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants