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
add_to_list (Ctrl->C.arg, "-dMaxBitmap=2147483647"); /* Add this as GS option to fix bug in GS */
I'm trying to find context on what that 'bug in GS (ghostscript)' is, since it was made >10 years ago (cbd67e1), going back to at least GMT 5. It seems that @remkos originally used -dMaxBitmap=100000000 for just psconvert ... -TG in 70e792e, and that number got increased to 2147483647 = 2^31-1 at some point, and applied to all psconvert operations.
Did you want to set a higher or lower dMaxBitmap? I see you mentioned -dMaxBitmap=2000000 first, but your error message shows -dMaxBitmap=20000000000. Either way, we probably need to handle this in GMT upstream, by unhardcoding the value somehow. cc @seisman.
Is there a way to keep the not yet converted ps-file, so I can try to run this via gmt call? I tried with setting pygmt.config(GMT_VERBOSE="d"), but it does remove the temp files.
ygmt-session [DEBUG]: GMT_Call_Command string: gmt psconvert -A -E50 -Fna_unified -Qg2 -Qt2 -Tf
pygmt-session [DEBUG]: Revised options: -A -E50 -Fna_unified -Qg2 -Qt2 -Tf
psconvert [DEBUG]: Ghostscript executable full name:
psconvert [DEBUG]: gmt_run_process_get_first_line: Pass to popen: [gs --version 2> /dev/null]
psconvert [DEBUG]: gs --version 2> /dev/null was successful
psconvert [DEBUG]: Ghostscript version: 10.07.0
psconvert [DEBUG]: Use PS filename /home/uliw/.gmt/sessions/gmt_session.66625/gmt_1.ps-
psconvert [DEBUG]: Hidden PS file /home/uliw/.gmt/sessions/gmt_session.66625/gmt_1.ps- found
psconvert [DEBUG]: Complete partial PS file /home/uliw/.gmt/sessions/gmt_session.66625/gmt_1.ps-
psconvert [DEBUG]: Size of half-baked PS file = 4226838795.
psconvert [DEBUG]: Fattened up PS file /home/uliw/.gmt/sessions/gmt_session.66625/gmt_1.ps-
psconvert [INFORMATION]: Processing /home/uliw/.gmt/sessions/gmt_session.66625/gmt_1.ps-...
psconvert [INFORMATION]: Find HiResBoundingBox ...
psconvert [DEBUG]: Running: gs -q -dNOSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox -DPSL_no_pagefill -dMaxBitmap=2147483647 -dUseFastColor=true '/home/uliw/.gmt/sessions/gmt_session.66625/gmt_1.ps-' 2> '/home/uliw/.gmt/sessions/gmt_session.66625/psconvert_66625c.bb'
Error: /limitcheck in /----nostringval----
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1804 1 3 %oparray_pop 1803 1 3 %oparray_pop 1788 1 3 %oparray_pop 1659 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push
Dictionary stack:
--dict:749/1123(ro)(G)-- --dict:0/20(G)-- --dict:85/200(L)-- --dict:157/250(L)--
Current allocation mode is local
Last OS error: No such file or directory
psconvert [ERROR]: System call [gs -q -dNOSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox -DPSL_no_pagefill -dMaxBitmap=2147483647 -dUseFastColor=true '/home/uliw/.gmt/sessions/gmt_session.66625/gmt_1.ps-' 2> '/home/uliw/.gmt/sessions/gmt_session.66625/psconvert_66625c.bb'] returned error 256.
psconvert [DEBUG]: Delete /home/uliw/.gmt/sessions/gmt_session.66625/psconvert_66625c.bb
Traceback (most recent call last):
File "/home/uliw/user/n_america/na_unified.py", line 134, in <module>
fig.savefig("na_unified.pdf", dpi=50,
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
# resize="+m2c",
^^^^^^^^^^^^^^^^
# gs_option="-dMaxBitmap=20000000000, -dMaxMemory=2000000000",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
) # Limit ghostscript memory)
^
File "/home/uliw/miniforge3/envs/py314/lib/python3.14/site-packages/pygmt/figure.py", line 254, in savefig
self.psconvert(prefix=prefix, fmt=fmts[ext], crop=crop, **kwargs)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/uliw/miniforge3/envs/py314/lib/python3.14/site-packages/pygmt/helpers/decorators.py", line 591, in new_module
return module_func(*args, **kwargs)
File "/home/uliw/miniforge3/envs/py314/lib/python3.14/site-packages/pygmt/src/psconvert.py", line 146, in psconvert
lib.call_module(module="psconvert", args=build_arg_list(aliasdict))
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/uliw/miniforge3/envs/py314/lib/python3.14/site-packages/pygmt/clib/session.py", line 671, in call_module
raise GMTCLibError(msg)
pygmt.exceptions.GMTCLibError: Module 'psconvert' failed with status code 79:
psconvert [ERROR]: System call [gs -q -dNOSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox -DPSL_no_pagefill -dMaxBitmap=2147483647 -dUseFastColor=true '/home/uliw/.gmt/sessions/gmt_session.66625/gmt_1.ps-' 2> '/home/uliw/.gmt/sessions/gmt_session.66625/psconvert_66625c.bb'] returned error 256.
pygmt-session [DEBUG]: gmtinit_parse_map_annot_oblique: Converted separate,lon_horizontal,lat_horizontal,tick_extend to 14
pygmt-session [DEBUG]: The PROJ_GEODESIC set to Vincenty
pygmt-session [DEBUG]: Exit: gmt_reload_settings
pygmt-session [DEBUG]: Enter: gmtlib_plot_C_format
pygmt-session [DEBUG]: Exit: gmtlib_plot_C_format
pygmt-session [DEBUG]: Enter: gmtinit_get_history
pygmt-session [DEBUG]: gmtlib_get_graphics_item: Fig: 1 Subplot: 2 Panel: () Inset: 0
pygmt-session [DEBUG]: Enter: gmt_hash_init
pygmt-session [DEBUG]: Exit: gmt_hash_init
pygmt-session [DEBUG]: Exit: gmtinit_get_history
pygmt-session [DEBUG]: Initialize FFTW with 32 threads.
pygmt-session [DEBUG]: GMT_Create_Session initialized GMT structure
pygmt-session [DEBUG]: Shared Library # 0 (core). Path = /home/uliw/miniforge3/envs/py314/lib/libgmt.so
pygmt-session [DEBUG]: Loading GMT plugins from: /home/uliw/miniforge3/envs/py314/lib/gmt/plugins
pygmt-session [DEBUG]: Shared Library # 1 (supplements). Path = /home/uliw/miniforge3/envs/py314/lib/gmt/plugins/supplements.so
pygmt-session [DEBUG]: GMT now running in modern mode [Session ID = 66625]
pygmt-session [DEBUG]: GMT_Call_Command string: gmt end (null)
pygmt-session [DEBUG]: Revised options: (null)
[Session pygmt-session (29)]: Error returned from GMT API: GMT_ARG_IS_NULL (4)
end [DEBUG]: End Workflow. Session ID = 66625. Directory /home/uliw/.gmt/sessions/gmt_session.66625 removed.
end [DEBUG]: Got session name as pygmt-session and default graphics formats as pdf
end [INFORMATION]: Process GMT figure queue: 2 figures found
end [INFORMATION]: Processing GMT figure #0 [pygmt-session pdf ]
end [INFORMATION]: Processing GMT figure GenericMappingTools/pygmt#1 [53d8375088584870b08da59151691f05 - ]
end [DEBUG]: GMT now running in modern mode [Session ID = 66625]
end [DEBUG]: GMT_Call_Command string: gmt figure 53d8375088584870b08da59151691f05
end [DEBUG]: Revised options: 53d8375088584870b08da59151691f05
end [DEBUG]: Enter: gmtinit_get_history
end [DEBUG]: gmtlib_get_graphics_item: Fig: 1 Subplot: 2 Panel: () Inset: 0
end [DEBUG]: Enter: gmt_hash_init
end [DEBUG]: Exit: gmt_hash_init
end [DEBUG]: Exit: gmtinit_get_history
end [INFORMATION]: Destroying the current workflow directory /home/uliw/.gmt/sessions/gmt_session.66625
end [DEBUG]: Delete gmt.1.cpt
end [DEBUG]: Delete gmt.1.legend
end [DEBUG]: Delete gmt.canvas.1
end [DEBUG]: Delete gmt.conf
end [DEBUG]: Delete gmt.conf.1
end [DEBUG]: Delete gmt.current
end [DEBUG]: Delete gmt.figures
end [DEBUG]: Delete gmt.frame.1
end [DEBUG]: Delete gmt.history
end [DEBUG]: Delete gmt.history.1
end [DEBUG]: Delete gmt.layers.1
end [DEBUG]: Delete gmt.session
end [DEBUG]: Delete gmt_1.ps-
I am trying to generate a high res map in poster format
Ah, if that's the case... Have you set the dpi/-E parameter? E.g. for grdimage, it defaults to dpi=100, but you can increase that to 300 or 600. Also, psconvert has a dpi parameter, but you need to make sure your underlying map layers (especially the raster ones) are all high resolution before changing that.
I placed a breakpoint before calling psconvert to get access to the ps file. Using this GS immediately exits upon reading the file with a limitcheck. In my understanding, this is because some numbers in the ps file exceed the postscript specification. So this may have nothing todo with gmt/pygmt.
👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. We appreciate that you took the time to contribute!
Activity
weiji14 commentedon Apr 12, 2026
Hmm yeah, so that
-dMaxBitmap=2147483647argument seems to be hardcoded in upstream GMT at https://github.com/GenericMappingTools/gmt/blame/9880a3118ebbcf7a1cb0115f832e8b07c2da47c9/src/psconvert.c#L1817.I'm trying to find context on what that 'bug in GS (ghostscript)' is, since it was made >10 years ago (cbd67e1), going back to at least GMT 5. It seems that @remkos originally used
-dMaxBitmap=100000000for justpsconvert ... -TGin 70e792e, and that number got increased to 2147483647 = 2^31-1 at some point, and applied to all psconvert operations.Did you want to set a higher or lower
dMaxBitmap? I see you mentioned-dMaxBitmap=2000000first, but your error message shows-dMaxBitmap=20000000000. Either way, we probably need to handle this in GMT upstream, by unhardcoding the value somehow. cc @seisman.uliw commentedon Apr 13, 2026
I am trying to generate a high res map in poster format, but the process fails, even so the system has plenty of free memory. Reading https://ghostscript.readthedocs.io/en/latest/Use.html it seems however that this parameter is only relevant for onscreen display. I'll experiment with gmt directly and follow up.
uliw commentedon Apr 13, 2026
Is there a way to keep the not yet converted ps-file, so I can try to run this via gmt call? I tried with setting
pygmt.config(GMT_VERBOSE="d"), but it does remove the temp files.weiji14 commentedon Apr 13, 2026
Ah, if that's the case... Have you set the
dpi/-Eparameter? E.g. forgrdimage, it defaults todpi=100, but you can increase that to 300 or 600. Also,psconverthas adpiparameter, but you need to make sure your underlying map layers (especially the raster ones) are all high resolution before changing that.uliw commentedon Apr 14, 2026
I placed a breakpoint before calling psconvert to get access to the ps file. Using this GS immediately exits upon reading the file with a limitcheck. In my understanding, this is because some numbers in the ps file exceed the postscript specification. So this may have nothing todo with gmt/pygmt.
seisman commentedon Apr 16, 2026
This is an upstream issue, so I'm transferring it to the upstream GMT repository.
To reproduce the issue in GMT CLI, try:
The output is
[-]pygmt.Figure.psconvert overwrites gs_option dMaxBitmap argument[/-][+]psconvert: gs options passed via -C doesn't override internally hardcoded options [/+]github-actions commentedon Apr 16, 2026
👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. We appreciate that you took the time to contribute!
Please make sure you read our Contributing Guide and abide by our Code of Conduct.
psconvert: fix gs options passed via -C
psconvert: fix gs options passed via -C (GenericMappingTools#8983)