Image formats for plots made with GMT

Hi everyone,

psconvert will output images to a variety of formats (ps, pdf, png, jpg etc). One format that it doesn’t support is webp, because Ghostscript doesn’t write this format.

However, I’ve found webp images can be somewhat smaller than PNG images, yet still be lossless, and support transparency. The image below is almost 20% smaller in webp format:

-rw-r--r--. 1 tim tim 410569 May  4 19:37 latest_stamps_006.png
-rw-r--r--. 1 tim tim 332378 May  4 19:38 latest_stamps_006.webp

This is useful for the website I’m creating; users are often on slow and sometimes unreliable Internet connections. It’s easy to convert PNG to Webp with Imagemagick:

magick file.png file.webp

Unfortunately the forum doesn’t seem to want to let me upload webp images, but most modern browsers support it.

pngquant can be (but not always) very, very efficient in reducing png file sizes. We use it in the GMT man pages and I use it too when posting images in the forum.

2 Likes

Oh. That was excellent! It reduced my 410 kByte file to 202 kByte.