[thelist] PHP GD library
Simon Perry
simon.perry at si-designs.co.uk
Mon Dec 8 16:16:25 CST 2003
Bill Haenel wrote:
>Anyone here have any experience in using GD to create good quality
>thumbnails?
>
>I have attempted it and the results are fair to poor. My professional
>photographer client will not be satisfied with less than good to
>excellent.
>
>I have also attempted to resize images to larger sizes, and although the
>results are a bit better than the thumbnails, they are at least slightly
>less than acceptable in several cases.
>
>PHP Version is 4.2.3
>GD Version is 1.6.2
>
>Advice?
>
>Thanks,
>Bill Haenel
>
>
Bill,
The usual cause of problems is the limited colour palette and running
out of allocated colours very quickly. This results in washed out or
even near black images depending on the original photo. IIRC your
version of GD only offers imagecreate() and not imagecreatetruecolor().
To get round this create a blank thumbnail image and save it first. This
ensures that you have a evenly distributed palette of 256 colours to
work from. If you skip this step then GD will allocate the first colours
it finds until it has 256 and from then only it will only use those 256
colours even if they are all shades of one colour!
If possible I would install a leter version of GD >2.01 as this will
give you access to imagecreatetruecolor() and allow you to use a 16m
colour palette. It is still advisable to create and save the thumbnail
image first. You can then also use imagecopyresampled() to scale your
original image as this is far more sophisticated than imagecopyresized().
If you are still having issues post a code sample we can have a look at.
Simon
More information about the thelist
mailing list