Skip to content

Image is not cropped by gmt end via the API #4518

Description

@sarzeaud

The API can be used to create an image file with exactly the same instructions as a script. However, with or without the A option on the gmt begin line, the figure is not cropped when gmt end show is called.

Take this simple script:


gmt begin toto_script jpg
gmt basemap -BWESN -Bxa30mg30m -Bya20mg20m -JM7.27/42.27/16.25c -R5.5/41.425/9.0/43.1r
gmt end show

resulting in this image:

toto_script

The same instructions via the API:


int main () {
void *API;

/* Initialize the GMT session */
if ((API = GMT_Create_Session ("GMT_plot", 2, 0, NULL)) == NULL)
   return EXIT_FAILURE;
GMT_Call_Module(API, "begin", GMT_MODULE_CMD, "toto_api jpg");
GMT_Call_Module(API, "basemap", GMT_MODULE_CMD, "-BWESN -Bxa30mg30m -Bya20mg20m -JM7.27/42.27/16.25c -R5.5/41.425/9.0/43.1r");
GMT_Call_Module(API, "end", GMT_MODULE_CMD, "show");
/* Destroy session */
if (GMT_Destroy_Session (API)) 
  return EXIT_FAILURE;
}

produce a different image, not cropped:

toto_api

Running gmt end show -Vd reveals the difference between script and API processing:

From script:
end [DEBUG]: psconvert: '/home/sarzeaud/.gmt/sessions/gmt_session.14414/gmt_0.ps-' -Tj -Ftoto -A
From C program (-A option is missing):
end [DEBUG]: psconvert: '/home/sarzeaud/.gmt/sessions/gmt_session.14414/gmt_0.ps-' -Tj -Ftoto

The result is the same whether or not we use the A option on the gmt begin line.

System information

  • Operating system: Debian stretch
  • GMT version (gmt --version): 6.2.0_d266c30_2020.11.25

Activity

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions