Error in the JFIF header in a jpeg file in version 6.7.9

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
vliegeois
Posts: 2
Joined: 2012-10-12T07:24:48-07:00
Authentication code: 67789

Error in the JFIF header in a jpeg file in version 6.7.9

Post by vliegeois »

I'm trying to convert a jpeg file using the option "-trim" before adding this file into a latex file.
However, since version 6.7.9, this produce an error. Imagemagick was build using macport on iMac on Mountain Lion.
I don't have this problem when using version 6.7.6 already installed on Mountain Lion.

When digging, it seems that the only difference between the two files produced after the command convert (one using version 6.7.9 and the other one using version 6.7.6) is in the JFIF header

hexdump -C c679.jpg |head -3
00000000 ff d8 ff e0 00 10 4a 46 49 46 00 01 01 01 00 01 |......JFIF......|
00000010 00 01 00 00 ff db 00 43 00 01 01 01 01 01 01 01 |.......C........|
00000020 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 |................|
From the description en.wikipedia.org/wiki/JPEG_File_Interchange_Format:
• APP0 marker (2 bytes): ff e0
• Length (2 bytes): 00 10
• Identifier (5 bytes): 4a 46 49 46 00 = “JFIF” with zero following • Version (2 bytes): 01 01
• Density units (1 byte): 01 = Pixels per inch
• X density (2 bytes): 00 01 = 1 #NOT GOOD
• Y density (2 bytes): 00 01 = 1 #NOT GOOD • Thumbnail width (1 byte): 00
• Thumbnail height (1 byte): 00


hexdump -C c676.jpg |head -3
00000000 ff d8 ff e0 00 10 4a 46 49 46 00 01 01 01 00 48 |......JFIF.....H|
00000010 00 48 00 00 ff db 00 43 00 01 01 01 01 01 01 01 |.H.....C........|
00000020 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 |................|
From the description en.wikipedia.org/wiki/JPEG_File_Interchange_Format: • APP0 marker (2 bytes): ff e0
• Length (2 bytes): 00 10
• Identifier (5 bytes): 4a 46 49 46 00 = “JFIF” with zero following
• Version (2 bytes): 01 01
• Density units (1 byte): 01 = Pixels per inch • X density (2 bytes): 00 48 = 72
• Y density (2 bytes): 00 48 = 72
• Thumbnail width (1 byte): 00
• Thumbnail height (1 byte): 00



I think the problem with the file c679.jpg is either the density units that should be 00 or the X and Y density that should be 00 48

I can attach the original and converted pictures if needed.

Vincent LIEGEOIS
vliegeois
Posts: 2
Joined: 2012-10-12T07:24:48-07:00
Authentication code: 67789

Re: Error in the JFIF header in a jpeg file in version 6.7.9

Post by vliegeois »

Here is the log file from the latex file in which i'm including c679.jpg and c676.jpg files:
pdfTeX warning: pdflatex: arithmetic: number too big
<c679.jpg, id=8, --32768.0pt x 0.0pt>
File: c679.jpg Graphic file (type jpg)
<use c679.jpg>
Package pdftex.def Info: c679.jpg used on input line 12.
(pdftex.def) Requested size: -122.95937pt x 0.0pt.
[2

<./c679.jpg>]
<c676.jpg, id=12, 1719.42375pt x 1412.27625pt>
File: c676.jpg Graphic file (type jpg)
<use c676.jpg>
Package pdftex.def Info: c676.jpg used on input line 17.
(pdftex.def) Requested size: 142.26378pt x 116.84178pt.
[3

<./c676.jpg>]

Everything is file for c676.jpg but there is a problem in the display of figure c679.jpg due to an error in the size coming, i thing, from the wrong data in JFIF header see previous post.

Note also that i don't have any problem if i convert the original file into a png file.

Vincent LIEGEOIS
Post Reply