Is there some library in Java to compress Png images like pngout?

3.3k views Asked by At

Is there some library in Java to compress Png images like pngout, pngcrush, optipng which are written in C/C++?

In continuation to what Phil has commented below, what I meant was reducing the file size of the image generated by the ImageIO class in Java by removing information that is not needed, same as what pngout does. When I ran pngout on the images that were generated by ImageIO class I was able to get about 50% reduction in file size (reduction size will vary based on images). So I wanted to know if there is any tool or library that could be interfaced with Java so that image files produced ImageIO class can have their size reduced.

2

There are 2 answers

0
justinhj On BEST ANSWER

You could call an executable from Java to do the work, or you could wrap the library using SWIG and call it from Java.

0
lothar On

JMagick provides an object-oriented Java interface to ImageMagick.

ImageMagick® is a software suite to create, edit, and compose bitmap images. It can read, convert and write images in a variety of formats (over 100) including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript, SVG, and TIFF. Use ImageMagick to translate, flip, mirror, rotate, scale, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.