Skip to content

Difference between begin and psconvert for pngs #8979

Closed

Description

@ESaltPi

Description of the problem

There is a difference between some of the option flags in gmt begin and gmt psconvert.

Full script that generated the error

#!/bin/bash
gmt begin test ps,png E720 -C
gmt basemap -R-2/2/-2/2 -JX5i/5i -BNSEW -Bpxa1 -Bpya1 -Xc -Y3.25i 
gmt end show
gmt psconvert test.ps -A -I+m0.1i -Tg -E720
rm -f gmt.conf gmt.history

The above will generate a png that has a page border of 0.1i, while putting the psconvert flags in the options in begin will result in a full size page png.

#!/bin/bash
gmt begin test ps,png A,E720,-I+m0.1i -C
gmt basemap -R-2/2/-2/2 -JX5i/5i -BNSEW -Bpxa1 -Bpya1 -Xc -Y3.25i 
gmt end show
rm -f gmt.conf gmt.history

Expected outcome

I would have expected gmt begin test ps,png A,E720,-I+m0.1i -C to produce a png that has a proper bounding box size in accordance with the -A and -I flags, but it only works when psconvert is called later. In either case, the bounding box resize only applies to the png and not the ps.

System information

  • Operating system: Linux Ubuntu 22.04
  • GMT version: 6.6.0

Activity

  1. added
    bug
    on Apr 15, 2026
  2. mkononets commented on Apr 15, 2026

    @mkononets

    A,E720,-I+m0.1i

    See there's no dash before A and E720? Remove the dash before I, then it'll work.

  3. mkononets commented on Apr 15, 2026

    @mkononets

    (meaning the topic is not a bug but a user typo)

  4. ESaltPi commented on Apr 15, 2026

    @ESaltPi
    Author

    Alas, the typo and user error was in me typing it into the bug report. It still doesnt work.

    #!/bin/bash
    gmt begin test ps,png A,E720,I+m0.1i -C
    gmt basemap -R-2/2/-2/2 -JX5i/5i -BNSEW -Bpxa1 -Bpya1 -Xc -Y3.25i 
    gmt end show
    rm -f gmt.conf gmt.history
    
  5. joa-quim commented on Apr 16, 2026

    @joa-quim
    Member

    There is something wrong indeed, but not what it looks on first look.

    In either case, the bounding box resize only applies to the png and not the ps.

    Well, up to GMT 6.6 (exclusive) the ps file was never changed by psconvert, only a copy of it when the EPS driver is selected. On 6.6 a new -! option changed that, but it's currently failing also in this case. The failure seems to be related to the inability to update the new BoundingBox (the shift to LL corner of the page is working ok).

    If you use

    gmt begin test eps,png A,E720,I+m0.1i -C ,
    you'll see what I mean and you can also see that the png version is fine. If you swap the order of formats (e.g., png,eps) it displays the correct png, but the eps is still incorrect.

  6. joa-quim commented on Apr 20, 2026

    @joa-quim
    Member

    This issue was fixed in master (issue #8992)

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions