Csaba Gabor <[EMAIL PROTECTED]> writes:

> When I want to save an image under php as a .jpg, I use:
> imagejpeg ($image, $destinationPath, $intQuality)
> see http://php.net/imagejpeg
>
> When I do an image resizing of a .JPG with PEL, I notice that the
> file size is quite a bit smaller (e.g. 150K vs. 450) than the .JPG I
> get when I use PHP5 without going through PEL (with $intQuality at
> 95), so I presume that PEL saves with a lesser image quality. So
> far, I haven't managed to track down where the corresponding quality
> setting is with PEL. Could someone give me a tip, please.

Ahh, very good question! Actually I haven't thought of this, so you
cannot control the quality setting at the moment...

But don't worry -- it's easy to fix. If you're using PEL as I think
you are (similar to examples/resize.php), then the quality loss occurs
when the PelJpeg constructor is given a PHP image resource. The
resource is converted into a JPEG image and the bytes are extraced
like this:

    } elseif (is_resource($data) && get_resource_type($data) == 'gd') {
      Pel::debug('Initializing PelJpeg object from image resource.');
      /* The ImageJpeg() function insists on printing the bytes
       * instead of returning them in a more civil way as a string, so
       * we have to buffer the output... */
      ob_start();
      ImageJpeg($data);
      $bytes = ob_get_clean();
      $this->load(new PelDataWindow($bytes));
    } else {

Simply change line 173 to

      ImageJpeg($data, null, 95);

and I think you should be fine.  I'll incorporate a quality setting
for the next release.

> Thanks,
> Csaba Gabor from Vienna
>
> PS. I am resizing images from my Olympus Stylus 1000 (including EXIF
> transfer) with PEL. As far as I can tell, the resizing/exif transfer
> is working well.

Cool, I'm glad to hear it!

> PPS. Sorry if this is a duplicate message. I attempted to post this
> yesterday, but there was no joy.

I think you did fine, I have only seen this one message from you.

-- 
Martin Geisler  ---  <[EMAIL PROTECTED]>  ---  http://mgeisler.net

Read, write, create Exif data in PHP with PEL:       http://pel.sf.net
Take control of your webserver with PHP Shell:  http://phpshell.sf.net

Attachment: pgpi8EFIaY1UZ.pgp
Description: PGP signature

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
PEL-devel mailing list
PEL-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pel-devel

Reply via email to