Feature #423

Let PS_IMAGE_COMPRESS default to DEFLATE if ZLIB available

Added by Florian over 5 years ago. Updated over 1 year ago.

Status:ClosedStart date:2013-10-29
Priority:NormalDue date:
Assignee:Florian% Done:


Target version:Candidate for next minor release


I added support for DEFLATE image compression in pslib in r12402 which performs slightly better than LZW:

gmt grdimage --PS_IMAGE_COMPRESS=rle -JX10c ex32/topo.nc -V
PSL: RLE compressed 1036800 to 776175 bytes (74.9%)

gmt grdimage --PS_IMAGE_COMPRESS=lzw -JX10c ex32/topo.nc -V
PSL: LZW compressed 1036800 to 292745 bytes (28.2%)

gmt grdimage --PS_IMAGE_COMPRESS=deflate -JX10c ex32/topo.nc -V
PSL: DEFLATE compressed 1036800 to 220439 bytes (21.3% at compression level 6)

gmt grdimage --PS_IMAGE_COMPRESS=deflate,9 -JX10c ex32/topo.nc -V
PSL: DEFLATE compressed 1036800 to 217048 bytes (20.9% at compression level 9)
Question: should we set DEFLATE as default when ZLIB is available?


#1 Updated by Joaquim over 5 years ago

But how will ZLIB be detected by cmake on Windows? I have one but don't see why it should be findable by cmake.

#2 Updated by Florian over 5 years ago

Ah, yes. ZLIB is so common that I didn't bother to add ZLIB_ROOT to ConfigUserTemplate.cmake (now in r12425).

#3 Updated by Florian over 5 years ago

Btw, we can reduce the file size of all PS files in doc and test subdirs from 92M to 79M by switching to deflate. This would make the tarballs and svn checkout a little bit smaller.

#4 Updated by Paul over 5 years ago

  • Status changed from New to Feedback

Is there any execution time penalty? I.e., does it run slower to do that compression? If not then I would think we would do this.

#5 Updated by Florian over 5 years ago

ZLIB's deflate is much faster than GMT's LZW for larger images. But the additional library call slows down the compression of small images time by a tiny (ms) amount. The benefits clearly outweigh the latency with small images.

#6 Updated by Paul over 1 year ago

  • Status changed from Feedback to Closed
  • Assignee set to Florian
  • % Done changed from 0 to 100

This was implemented by Florian years ago but the issue was left open. Closed now.

Also available in: Atom PDF