JPEG file size increase with upgraded version

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
j689
Posts: 4
Joined: 2016-12-15T13:08:08-07:00
Authentication code: 1151

JPEG file size increase with upgraded version

Post 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?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: JPEG file size increase with upgraded version

Post 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?
j689
Posts: 4
Joined: 2016-12-15T13:08:08-07:00
Authentication code: 1151

Re: JPEG file size increase with upgraded version

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: JPEG file size increase with upgraded version

Post by fmw42 »

What was your exact command using pdftoppm
j689
Posts: 4
Joined: 2016-12-15T13:08:08-07:00
Authentication code: 1151

Re: JPEG file size increase with upgraded version

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: JPEG file size increase with upgraded version

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: JPEG file size increase with upgraded version

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: JPEG file size increase with upgraded version

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: JPEG file size increase with upgraded version

Post by fmw42 »

Processing was done on my Mac Mini OSX Snow Leopard.
j689
Posts: 4
Joined: 2016-12-15T13:08:08-07:00
Authentication code: 1151

Re: JPEG file size increase with upgraded version

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: JPEG file size increase with upgraded version

Post 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.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: JPEG file size increase with upgraded version

Post 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.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: JPEG file size increase with upgraded version

Post by anthony »

Could the older version of IM have been built using a different JPEG library?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply