RE: [PHP] Poor results with GD
Excellent advice, thanks. I was using GD 1.6.2 :( so will sort this and try again. Mick -Original Message- From: Richard Archer [mailto:[EMAIL PROTECTED]] Sent: 15 April 2002 22:58 To: [EMAIL PROTECTED] Subject: Re: [PHP] Poor results with GD At 5:32 PM +0200 15/4/02, Sear, Mick wrote: >Not sure if anyone else uses GD much, but I've been experimenting with it >and PHP recently and I've found I get large file sizes and very 'aliased' >graphics. gd is the correct tool for your job. But there are some caveats. You will need to be using gd-2.0 or better to get satisfactory results for this sort of work. gd-2.0.1 supports: bicubic interpolation for scaling images 24-bit (true colour) images Make sure your images aren't being converted to 8-bit at any stage of the scaling/cropping process. Use ImageCreateTrueColor to create images. Oh, and there's a bug in either php-4.1.2 or gd-2.0.1 where scaling and cropping with one operation using imagecopyresampled fails. I use a work-around of cropping with imagecopyresized and then scaling with imagecopyresampled. The large file sizes could be improved by reducing the quality of the JPEG compression. Also, once the images have been scaled smoothly, there will be fewer sharp edges allowing JPEG compression to be more efficient. ...R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Poor results with GD
Hi - I recently used NetPBM libraries since a client was not satisfied with GD's results. You may want to have a look at PHP Gallery, a package which uses NetPBM instead of Gd. I looked at it to get some idea on how to use NetPBM from PHP. They have a comparison page: http://www.menalto.com/projects/gallery/modules.php?op=modload&name=NetPbmVsGd&file=index Cheers, Gianluca > I'm currently setting JPEG quality to 85%, hence the large file sizes. > Normally, I'd be looking for better quality and file sizes about 70% of > their current size. Some of the originals are scanned directly from the > painting, which yields very high quality, some are taken with a digital > camera (I could live with poorer quality on these). > > I'm using some functions I found in 'PHP and MySQL web development' with > some modifications, so JPEGs are generated from uploaded files and stored > on the server through an HTML form interface. Here's the core bit of the > code: > > $src = ImageCreateFromJPEG($image); > $dst = ImageCreate($tn_width,$tn_height); > ImageCopyResized($dst, $src, 0, 0, 0, 0, > $tn_width,$tn_height,$width,$height); > ImageJpeg($dst, $path, $compression); //compression set to 85 here. > ImageDestroy($src); > ImageDestroy($dst); > > Mick > > > -Original Message- > From: Andrew Brampton [mailto:[EMAIL PROTECTED]] > Sent: 15 April 2002 17:56 > To: Sear, Mick; [EMAIL PROTECTED] > Subject: Re: [PHP] Poor results with GD > > > They looked ok to me, but I don't know what the orginals looked like. > > But the problem might be that your JPeg quality is set lower than you would > like. You can increase it be setting a parameter in ImageJPEG() or most > likly whatever function you are using > > Andrew > - Original Message - > From: "Sear, Mick" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, April 15, 2002 4:32 PM > Subject: [PHP] Poor results with GD > > > Not sure if anyone else uses GD much, but I've been experimenting with it > > and PHP recently and I've found I get large file sizes and very 'aliased' > > graphics. > > > > Can anyone suggest a fix/ alternative? > > > > You'll see what I mean if you look at www.msear.com/paintings/ where the > > images are currently all generated with GD (but not for long, I think!) > > > > Cheers, > > Mick > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php -- Gianluca Baldo Mallorca 186 - 3º 1ª 08036 Barcelona (Spain) tel/fax +34 93 454 93 24 http://www.phpauction.org http://www.gianlucabaldo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Poor results with GD
I'm currently setting JPEG quality to 85%, hence the large file sizes. Normally, I'd be looking for better quality and file sizes about 70% of their current size. Some of the originals are scanned directly from the painting, which yields very high quality, some are taken with a digital camera (I could live with poorer quality on these). I'm using some functions I found in 'PHP and MySQL web development' with some modifications, so JPEGs are generated from uploaded files and stored on the server through an HTML form interface. Here's the core bit of the code: $src = ImageCreateFromJPEG($image); $dst = ImageCreate($tn_width,$tn_height); ImageCopyResized($dst, $src, 0, 0, 0, 0, $tn_width,$tn_height,$width,$height); ImageJpeg($dst, $path, $compression); //compression set to 85 here. ImageDestroy($src); ImageDestroy($dst); Mick -Original Message- From: Andrew Brampton [mailto:[EMAIL PROTECTED]] Sent: 15 April 2002 17:56 To: Sear, Mick; [EMAIL PROTECTED] Subject: Re: [PHP] Poor results with GD They looked ok to me, but I don't know what the orginals looked like. But the problem might be that your JPeg quality is set lower than you would like. You can increase it be setting a parameter in ImageJPEG() or most likly whatever function you are using Andrew - Original Message - From: "Sear, Mick" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, April 15, 2002 4:32 PM Subject: [PHP] Poor results with GD > Not sure if anyone else uses GD much, but I've been experimenting with it > and PHP recently and I've found I get large file sizes and very 'aliased' > graphics. > > Can anyone suggest a fix/ alternative? > > You'll see what I mean if you look at www.msear.com/paintings/ where the > images are currently all generated with GD (but not for long, I think!) > > Cheers, > Mick > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Poor results with GD
At 5:32 PM +0200 15/4/02, Sear, Mick wrote: >Not sure if anyone else uses GD much, but I've been experimenting with it >and PHP recently and I've found I get large file sizes and very 'aliased' >graphics. gd is the correct tool for your job. But there are some caveats. You will need to be using gd-2.0 or better to get satisfactory results for this sort of work. gd-2.0.1 supports: bicubic interpolation for scaling images 24-bit (true colour) images Make sure your images aren't being converted to 8-bit at any stage of the scaling/cropping process. Use ImageCreateTrueColor to create images. Oh, and there's a bug in either php-4.1.2 or gd-2.0.1 where scaling and cropping with one operation using imagecopyresampled fails. I use a work-around of cropping with imagecopyresized and then scaling with imagecopyresampled. The large file sizes could be improved by reducing the quality of the JPEG compression. Also, once the images have been scaled smoothly, there will be fewer sharp edges allowing JPEG compression to be more efficient. ...R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Poor results with GD
They looked ok to me, but I don't know what the orginals looked like. But the problem might be that your JPeg quality is set lower than you would like. You can increase it be setting a parameter in ImageJPEG() or most likly whatever function you are using Andrew - Original Message - From: "Sear, Mick" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, April 15, 2002 4:32 PM Subject: [PHP] Poor results with GD > Not sure if anyone else uses GD much, but I've been experimenting with it > and PHP recently and I've found I get large file sizes and very 'aliased' > graphics. > > Can anyone suggest a fix/ alternative? > > You'll see what I mean if you look at www.msear.com/paintings/ where the > images are currently all generated with GD (but not for long, I think!) > > Cheers, > Mick > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php