[magick-users] JFIF 1.02 problems.

Paul Homer paul at medeagroup.com
Fri Jun 7 08:48:06 PDT 2002


Hi,

Niall O Broin wrote:

>On Wed, Jun 05, 2002 at 07:17:06AM -0400, Paul Homer wrote:
>
>>I have a bunch of JPEG files that are listed as type JFIF 1.02. In these 
>>files (written with Photoshop) there is apparently an  APP14 marker that 
>>causes problems with older JPEG libraries like the one used in Acrobat 
>>3. In Linux's xpdf (which is fairly old, and similarly cranky as Acrobat 
>>3) I get:
>>
>>Error (48711): Bad DCT Adobe APP14 marker
>>
>>In Acrobat 3.0 I get the delightfully verbose 'Error 28' message.  
>>
>>I would like to write a perl script that opens the JPEGs, removes the 
>>markers and then writes them out again. I am fine with staying with JFIF 
>>1.02, or I could allow going to JFIF 1.01. So long as Acrobat 3.0 
>>doesn't have a problem with the images. I tried something like:
>>
>
>>Even without touching the profile information, IM changes the resolution 
>>from 100 DPI to 72 DPI. I also suspect that IM is uncompressing the 
>>image (compressed at quaility 90 originally) and recompressing at 
>>qauility 75. That would account for the new image being half the size of 
>>the original.
>>
>
>IM doesn't change the resolution (because bitmap images don't have a
>resolution - they're just a collection of pixels) but it does change the
>resolution marker in the header - I guess it defaults to 72 DPI but this can
>be changed (don't remember how - it was discussed here quite recently, so a
>search of the archives will help). IM does rewrite the image so that
>accounts for the change in size.
>
If I have to make changes to the new JPEG, the best I could hope for is 
to minimize the changes that I am making. The incomming images can be 
virtually any variety of JPEG including CMYKs. What I really need to do 
is read the image, get all the possibly changable params like the 
resolution marker, and then make sure that the final JPEG gets written 
out as close to the original as possible.

I guess there is nothing I can do with the quality? The original 
quaility probably isn't listed in the JPEG? I would really like to find 
a quality setting that allows the final file size to be as close as 
possible to the original file size. I also want to preserve the 
resoultion markers, and any other data.... What other data will change?

Any ideas?

>
>>Is there a way to remove the marker without actually touching the JPEG? 
>>
>
>Not with IM at the moment.
>
I'll check CPAN to see if there are any Perl solutions, but I have 
cross-platforms issues to deal with as well, and sometimes this leads to 
problems :-) (I develop on Linux, and deploy to NT :-)

>
>
>>This is a low resolution examples, but many of the files need to be at 
>>least 300 DPI, and can't afford to be re-compressed.
>>
>
>As mentioned, a JPEG doesn't have an inherent resolution - it's just an
>array of pixels and it only acquires a resolution when it's displayed or
>printed. It can have a resolution marker, which can be chnaged at will.
>Unfortunately using IM to process the files will result in re-compressing
>them which does have a deleterious effect even if you do save them at the
>same quality level.
>
So long as I keep it to the bare minimum, I think it should be ok.... 
(Famous last words :-)

>
>
>Kindest regards,
>
>
>
>Niall  O Broin
>

Thanks,


Paul.

>
>_______________________________________________
>Magick-users mailing list
>Magick-users at imagemagick.org
>http://studio.imagemagick.org/mailman/listinfo/magick-users
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://studio.imagemagick.org/pipermail/magick-users/attachments/20020607/74757cfc/attachment.htm


More information about the Magick-users mailing list