Page 1 of 1

JPEG file size increase with upgraded version

Posted: 2016-12-15T13:17:49-07:00
by j689
I'm converting a pdf to a jpeg on linux. I run it through pdftoppm to get a ppm file, and then convert the ppm to a jpg using Imagemagick.

However, when I use a newer version of imagemagick, the jpeg filesize is an order of magnitude larger with the same command and same source file.

The command I run:
convert -append foo.ppm -resize 943 -quality 100 foo.jpg

With old imagemagick (6.7.8-9 2014-04-01 Q16) the file size is 595K.
With new imagemagick (6.9.3-0 Q16) the file size is 6.6M.

Is there a change between the versions that would cause the file size to increase? Is there an option to be able to get it down to the small size?

Re: JPEG file size increase with upgraded version

Posted: 2016-12-15T13:34:47-07:00
by fmw42
Did you check the size of the PPM image in both cases? Are they the same? Why do you need to convert to PPM first? You can convert directly from the PDF to JPG. Why do you need -append? Even if you need it, it should come after reading the PPM for proper IM 6 syntax. See http://www.imagemagick.org/Usage/basics/#why. Can you post a link to your PDF or PPM image, so we can test using your two IM versions and check the nature of the PDF or PPM image.

What are the versions of libjpeg on the two systems. Perhaps they are different and produce different results or set the quality differently?

Re: JPEG file size increase with upgraded version

Posted: 2016-12-15T14:09:29-07:00
by j689
Both systems have libjpeg.so.62
The pdf usually has a few images that are extracted to multiple ppms and then combined to one jpeg, thus the use of -append.
The same source file is used on both systems.
A sample pdf is:
http://www.hollandamerica.com/assets/cr ... dinner.pdf

Re: JPEG file size increase with upgraded version

Posted: 2016-12-15T14:18:58-07:00
by fmw42
What was your exact command using pdftoppm

Re: JPEG file size increase with upgraded version

Posted: 2016-12-15T14:37:43-07:00
by j689
In this case,
pdftoppm menu_pinnacle_grill_dinner.pdf foo
This produced three ppms, I tried using convert with just one (foo-1.ppm) or multiple (foo*.ppm). Both produced an order of magnitude difference in size.

Re: JPEG file size increase with upgraded version

Posted: 2016-12-15T14:39:47-07:00
by fmw42
I just did the following

Code: Select all

im6789 convert menu_pinnacle_grill_dinner.pdf -append -quality 100 menu_pinnacle_grill_dinner_6789.jpg
im6930 convert menu_pinnacle_grill_dinner.pdf -append -quality 100 menu_pinnacle_grill_dinner_6930.jpg

identify menu_pinnacle_grill_dinner_6789.jpg menu_pinnacle_grill_dinner_6930.jpg
menu_pinnacle_grill_dinner_6789.jpg JPEG 612x2376 612x2376+0+0 8-bit sRGB 445KB 0.000u 0:00.000
menu_pinnacle_grill_dinner_6930.jpg JPEG 612x2376 612x2376+0+0 8-bit sRGB 445KB 0.000u 0:00.000

The results are identical

Re: JPEG file size increase with upgraded version

Posted: 2016-12-15T14:41:59-07:00
by fmw42
Also

Code: Select all

im6789 identify menu_pinnacle_grill_dinner_6789.jpg menu_pinnacle_grill_dinner_6930.jpg
menu_pinnacle_grill_dinner_6789.jpg JPEG 612x2376 612x2376+0+0 8-bit DirectClass 445KB 0.000u 0:00.000
menu_pinnacle_grill_dinner_6930.jpg[1] JPEG 612x2376 612x2376+0+0 8-bit DirectClass 445KB 0.000u 0:00.000

Code: Select all

im6930 identify menu_pinnacle_grill_dinner_6789.jpg menu_pinnacle_grill_dinner_6930.jpg
menu_pinnacle_grill_dinner_6789.jpg JPEG 612x2376 612x2376+0+0 8-bit sRGB 445KB 0.000u 0:00.000
menu_pinnacle_grill_dinner_6930.jpg JPEG 612x2376 612x2376+0+0 8-bit sRGB 445KB 0.000u 0:00.000

Re: JPEG file size increase with upgraded version

Posted: 2016-12-15T14:46:47-07:00
by fmw42
I also converted your pdf to PPM using your command.

Code: Select all

pdftoppm menu_pinnacle_grill_dinner.pdf foo

Code: Select all

im6789 convert foo-1.ppm -quality 100 foo-1_6789.jpg
im6930 convert foo-1.ppm -quality 100 foo-1_6930.jpg

Code: Select all

identify foo-1_6789.jpg foo-1_6930.jpg

foo-1_6789.jpg JPEG 1275x1651 1275x1651+0+0 8-bit sRGB 447KB 0.000u 0:00.000
foo-1_6930.jpg JPEG 1275x1651 1275x1651+0+0 8-bit sRGB 447KB 0.000u 0:00.000

Identical again

Re: JPEG file size increase with upgraded version

Posted: 2016-12-15T14:47:59-07:00
by fmw42
Processing was done on my Mac Mini OSX Snow Leopard.

Re: JPEG file size increase with upgraded version

Posted: 2016-12-15T15:08:32-07:00
by j689
Very baffling. I run the same commands, and get a much larger file size with the 6930 version of imagemagick.

$ pdftoppm menu_pinnacle_grill_dinner.pdf foo
Error: Mismatch between font type and embedded font file
Error: Mismatch between font type and embedded font file
Error: Mismatch between font type and embedded font file
Error: Mismatch between font type and embedded font file
Error: Mismatch between font type and embedded font file
$ convert foo-1.ppm -quality 100 foo_1_6930.jpg
convert: UnableToOpenConfigureFile `delegates.xml' @ warning/configure.c/GetConfigureOptions/706.
$ identify foo_1_6930.jpg
foo_1_6930.jpg PPM 1275x1651 1275x1651+0+0 8-bit sRGB 6.315MB 0.000u 0:00.000
$ convert --version
Version: ImageMagick 6.9.3-0 Q16 x86_64 2016-04-20 http://www.imagemagick.org

Re: JPEG file size increase with upgraded version

Posted: 2016-12-15T15:15:23-07:00
by snibgo
j689 wrote:convert: UnableToOpenConfigureFile `delegates.xml' @ warning/configure.c/GetConfigureOptions/706.
IM can't open its own configuration files. Something is seriously wrong. I suggest you cure that before bothering about anything else.

Re: JPEG file size increase with upgraded version

Posted: 2016-12-15T15:29:52-07:00
by fmw42
pdftoppm menu_pinnacle_grill_dinner.pdf foo
Error: Mismatch between font type and embedded font file
Error: Mismatch between font type and embedded font file
Error: Mismatch between font type and embedded font file
Error: Mismatch between font type and embedded font file
Error: Mismatch between font type and embedded font file
Something is wrong if you get these errors.

Did you get them on the other system? If not, check the file sizes of the PPM images on both systems. My guess is that your two PPM files are not the same size, since on one system you got these errors. That probably means that the default arguments were not used or the file was corrupted and became much larger.


You should probably recompile IM 6.9.3-0 after checking to make sure you have the appropriate delegates for fonts, such as freetype and perhaps fontconfig.

convert -version

and

convert -list format

should help tell you want delegates you have and what versions for 6.9.3.0.

Re: JPEG file size increase with upgraded version

Posted: 2016-12-15T23:24:48-07:00
by anthony
Could the older version of IM have been built using a different JPEG library?