Skip to content

Figure.image: Plot raster or EPS images #4263

Closed

Description

@seisman

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.

Documentation

GMT Option Flags and Modifiers

☑️: Implemented; ⬜: To be implemented/discussed; Strikethrough: Won't implement.

Linked Pull Requests

  • Initial feature implementation
  • Add a tutorial or gallery example

Related Issues and Discussions

Add links to related wrapper discussions, API design threads, or upstream GMT changes here.

Activity

  1. moved this from 0) Wishlist to 4) Gallery|tutorial example in PyGMT: Wrapping GMT moduleson Dec 10, 2025
  2. seisman commented on Dec 15, 2025

    @seisman
    MemberAuthor

    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
    
    image-G

    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.

  3. added this to the 0.1.x milestone on Dec 15, 2025
  4. moved this to Ongoing maintenance in PyGMT: Wrapping GMT moduleson Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions