<html>
<head>
</head>
<body>
Hi,<br>
<br>
Niall O Broin wrote:<br>
<blockquote type="cite" cite="mid:20020606081857.A24159@magic.digiserve.ie">
  <pre wrap="">On Wed, Jun 05, 2002 at 07:17:06AM -0400, Paul Homer wrote:<br><br></pre>
  <blockquote type="cite">
    <pre wrap="">I have a bunch of JPEG files that are listed as type JFIF 1.02. In these <br>files (written with Photoshop) there is apparently an  APP14 marker that <br>causes problems with older JPEG libraries like the one used in Acrobat <br>3. In Li
nux's xpdf (which is fairly old, and similarly cranky as Acrobat <br>3) I get:<br><br>Error (48711): Bad DCT Adobe APP14 marker<br><br>In Acrobat 3.0 I get the delightfully verbose 'Error 28' message.  <br><br>I would like to write a perl script that ope
ns the JPEGs, removes the <br>markers and then writes them out again. I am fine with staying with JFIF <br>1.02, or I could allow going to JFIF 1.01. So long as Acrobat 3.0 <br>doesn't have a problem with the images. I tried something like:<br></pre>
    </blockquote>
    <pre wrap=""><!----><br></pre>
    <blockquote type="cite">
      <pre wrap="">Even without touching the profile information, IM changes the resolution <br>from 100 DPI to 72 DPI. I also suspect that IM is uncompressing the <br>image (compressed at quaility 90 originally) and recompressing at <br>qauility 75. Tha
t would account for the new image being half the size of <br>the original.<br></pre>
      </blockquote>
      <pre wrap=""><!----><br>IM doesn't change the resolution (because bitmap images don't have a<br>resolution - they're just a collection of pixels) but it does change the<br>resolution marker in the header - I guess it defaults to 72 DPI but this can
<br>be changed (don't remember how - it was discussed here quite recently, so a<br>search of the archives will help). IM does rewrite the image so that<br>accounts for the change in size.<br></pre>
      </blockquote>
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. <br>
      <br>
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?<br>
      <br>
Any ideas?<br>
      <blockquote type="cite" cite="mid:20020606081857.A24159@magic.digiserve.ie">
        <pre wrap=""><br></pre>
        <blockquote type="cite">
          <pre wrap="">Is there a way to remove the marker without actually touching the JPEG? <br></pre>
          </blockquote>
          <pre wrap=""><!----><br>Not with IM at the moment.</pre>
          </blockquote>
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 :-)<br>
          <blockquote type="cite" cite="mid:20020606081857.A24159@magic.digiserve.ie">
            <pre wrap=""><br><br></pre>
            <blockquote type="cite">
              <pre wrap="">This is a low resolution examples, but many of the files need to be at <br>least 300 DPI, and can't afford to be re-compressed.<br></pre>
              </blockquote>
              <pre wrap=""><!----><br>As mentioned, a JPEG doesn't have an inherent resolution - it's just an<br>array of pixels and it only acquires a resolution when it's displayed or<br>printed. It can have a resolution marker, which can be chnaged at
 will.<br>Unfortunately using IM to process the files will result in re-compressing<br>them which does have a deleterious effect even if you do save them at the<br>same quality level.<br><br></pre>
              </blockquote>
So long as I keep it to the bare minimum, I think it should be ok.... (Famous
last words :-)<br>
              <blockquote type="cite" cite="mid:20020606081857.A24159@magic.digiserve.ie">
                <pre wrap=""><br><br>Kindest regards,<br><br><br><br>Niall  O Broin</pre>
                </blockquote>
                <br>
Thanks,<br>
                <br>
                <br>
Paul.<br>
                <blockquote type="cite" cite="mid:20020606081857.A24159@magic.digiserve.ie">
                  <pre wrap=""><br>_______________________________________________<br>Magick-users mailing list<br><a class="moz-txt-link-abbreviated" href="mailto:Magick-users@imagemagick.org">Magick-users@imagemagick.org</a><br><a class="moz-txt-link-f
reetext" href="http://studio.imagemagick.org/mailman/listinfo/magick-users">http://studio.imagemagick.org/mailman/listinfo/magick-users</a><br><br></pre>
                  </blockquote>
                  <br>
                  </body>
                  </html>