Skip to content

Conversation

seisman
Copy link
Member

@seisman seisman commented Sep 15, 2025

@seisman seisman added this to the 0.17.0 milestone Sep 15, 2025
@seisman seisman added enhancement Improving an existing feature needs review This PR has higher priority and needs review. labels Sep 15, 2025
Comment on lines +73 to +75
invert
Invert 1-bit image before plotting, i.e., black pixels (on) becomes white (off)
and vice versa. Ignored if used with color images.
Copy link
Member

@yvonnefroehlich yvonnefroehlich Sep 15, 2025

Choose a reason for hiding this comment

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

Hm, just trying this and maybe I am missing something here. I thought the remote raster image "vader1.png" is such a 1-bit image (see the last example at https://docs.generic-mapping-tools.org/dev/image.html#examples), but using I=True does not flip the black and white pixels as expected:

import pygmt

fig = pygmt.Figure()
fig.basemap(region=[-5, 5] * 2, projection="X3c/1c", frame=0)

fig.image(imagefile="@vader1.png", position="jLM")
fig.image(imagefile="@vader1.png", position="jMC", bitcolor=["gray+f", "blue+b"])
fig.image(imagefile="@vader1.png", position="jRM", I=True)  # Does not do something
# fig.image(imagefile="@vader1.png", position="jRM", bitcolor=["black+f", "white+b"])

fig.show()
image_invert

Same for

gmt image @vader1.png -I -png image_I_gmt
image_I_gmt

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm, it looks like an upstream bug.

Copy link
Member

Choose a reason for hiding this comment

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

I tested it with the gmt dev version, and still no inverted colors. Thus, I wrote an issue report at GenericMappingTools/gmt#8795.

@seisman seisman removed the needs review This PR has higher priority and needs review. label Sep 16, 2025
@seisman seisman marked this pull request as draft September 16, 2025 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improving an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants