You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue serves as the central place for discussing and tracking the implementation of the image method in PyGMT. The issue will be closed when the initial implementation is complete. Progress is tracked at PyGMT: Wrapping GMT modules.
Here is a GMT CLI script to understand the behavior of the -G option:
gmt begin image-G
gmt basemap -R0/10/0/5 -JX10c/5c -Baf -B+glightblue
gmt image @vader1.png -Dx0/0
gmt image @vader1.png -Dx1/0 -G
gmt image @vader1.png -Dx2/0 -Gblue
gmt image @vader1.png -Dx1/1 -G+f
gmt image @vader1.png -Dx2/1 -Gblue+f
gmt image @vader1.png -Dx1/2 -G+b
gmt image @vader1.png -Dx2/2 -Gblue+b
# Error: Only one of fore/back-ground can be transparent for 1-bit images
gmt image @vader1.png -Dx0/3 -G+b -G+f
gmt image @vader1.png -Dx1/3 -Gblue+b -Gred+f
# Your -G<color>+t is ignored for 1-bit images; see +b/+f modifiers instead
gmt image @vader1.png -Dx0/4 -Gblack+t
gmt end show
As shown above, -G without modifiers applies to the foreground color by default.
Currently, we use the parameter name bitcolor (or bit_color) but the argument is not Pythonic. I think it makes more sense to split it into multiple parameters, e.g., bgcolor/fgcolor (note that the same names are used in the Pattern class).
-G/-G+f => fgcolor=""
-Gblue/-Gblue+f => fgcolor="blue"
-G+b => bgcolor=""
-Gblue+b => bgcolor=""
-Gblue+b -Gred+f => bgcolor="blue", fgcolor="red"
The +t modifier is different, and only works for colored images. What about transparent_colors, which can takes a single color or a list of colors. Edit: -t only accepts only color and can't be repeated, so transparent_color make more sense.
Activity
seisman commentedon Dec 15, 2025
Here is a GMT CLI script to understand the behavior of the
-Goption:As shown above,
-Gwithout modifiers applies to the foreground color by default.Currently, we use the parameter name
bitcolor(orbit_color) but the argument is not Pythonic. I think it makes more sense to split it into multiple parameters, e.g.,bgcolor/fgcolor(note that the same names are used in thePatternclass).-G/-G+f=>fgcolor=""-Gblue/-Gblue+f=>fgcolor="blue"-G+b=>bgcolor=""-Gblue+b=>bgcolor=""-Gblue+b -Gred+f=>bgcolor="blue", fgcolor="red"The
+tmodifier is different, and only works for colored images.What aboutEdit:transparent_colors, which can takes a single color or a list of colors.-tonly accepts only color and can't be repeated, sotransparent_colormake more sense.