Skip to content

Support "jpeg" as file extension #2689

@seisman

Description

@seisman
In [1]: import pygmt
   ...: fig = pygmt.Figure()
   ...: fig.basemap(region=[0, 10, 0, 10], frame=True)
   ...: fig.savefig("map.jpeg")
---------------------------------------------------------------------------
GMTInvalidInput                           Traceback (most recent call last)
Cell In[1], line 4
      2 fig = pygmt.Figure()
      3 fig.basemap(region=[0, 10, 0, 10], frame=True)
----> 4 fig.savefig("map.jpeg")

File /pygmt/figure.py:315, in Figure.savefig(self, fname, transparent, crop, anti_alias, show, **kwargs)
    310     if ext == "ps":
    311         raise GMTInvalidInput(
    312             "Extension '.ps' is not supported. "
    313             "Please use '.eps' or '.pdf' instead."
    314         )
--> 315     raise GMTInvalidInput(f"Unknown extension '.{ext}'.")
    316 fmt = fmts[ext]
    317 if transparent:

GMTInvalidInput: Unknown extension '.jpeg'.

Currently, only jpg is supported, jpeg is not, and GMT supports both.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions