Repository navigation
Figure.image: Add the parameter 'invert' for option -I - #4089
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.
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.
Hmm, it looks like an upstream bug.
There was a problem hiding this comment.
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.
The upstream bug has been fixed.
I've added a note in the docstrings.
196f51b to
40b3933
Compare
40b3933 to
22ac054
Compare
Co-authored-by: Michael Grund <[email protected]>
Alias
-Ioption toinvertand also sort parameters based on #4285.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
Related to #4263