0
convert -strip -interlace JPEG -quality 80 origi.jpg output-file.jpg

origi image size : 40.6 kb output-file image size : 11.3 kb

But if I convert one png file as

convert -strip -interlace PNG -quality 80 he.png output-file.png

he.png image size : 711 kb output-file image size : 1 mb

convert -strip -interlace PNG he.png output-file.png

he.png image size : 711 kb output-file image size : 972.3 kb

Why the file size has been increased in case of PNG after conversion to output-file.png?

Am I using correct parameters for png conversions?

Gopi
  • 21
  • 4
  • What happens if you convert output-file.png into another image? It could be your input and output png images are of a different type. Also your input image should come straight after convert. – Bonzo Sep 10 '16 at 11:51

1 Answers1

2

If you convert a regular PNG image into an interlaced one, the resulting filesize will probably be larger, as explained in the PNG specification (emphasis added):

Pass extraction ... splits a PNG image into a sequence of reduced images (the interlaced PNG image) where the first image defines a coarse view and subsequent images enhance this coarse view until the last image completes the PNG image. This allows progressive display of the interlaced PNG image by the decoder and allows images to "fade in" when they are being displayed on-the-fly. On average, interlacing slightly expands the datastream size, but it can give the user a meaningful display much more rapidly.

The "-quality 80" option was not helpful because that forced ImageMagick to not use "filtering" to improve compression.

Glenn Randers-Pehrson
  • 11,940
  • 3
  • 37
  • 61