-
Notifications
You must be signed in to change notification settings - Fork 234
Figure.image: Add the parameter 'invert' for option -I #4089
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| invert | ||
| Invert 1-bit image before plotting, i.e., black pixels (on) becomes white (off) | ||
| and vice versa. Ignored if used with color images. |
There was a problem hiding this comment.
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()
Same for
gmt image @vader1.png -I -png image_I_gmt
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The upstream bug has been fixed.
I've added a note in the docstrings.
196f51b to
40b3933
Compare
40b3933 to
22ac054
Compare
Alias
-Ioption toinvert.Upstream docs: https://docs.generic-mapping-tools.org/6.5/image.html#i
Preview: https://pygmt-dev--4089.org.readthedocs.build/en/4089/api/generated/pygmt.Figure.image.html