Scaling down png image using GD library in PHP


I am using PHP and GD library to create png images on the fly.  Most of the time, these images are too large to fit into a A4 size print page. Is there any way to resize these images once the png file is created?


Who is Participating?
Marcus BointonConnect With a Mentor Commented:
You can scale the image down using the above functions, but it will degrade output quality, especially for print.

The print size is independent of the pixel size. Most image formats allow you to specify a real world resolution (though Windows tends to ignore it), or you can simply assign an image a size in real-world dimensions (like mm or inches) in your print-specific stylesheet (You do have one of those right? ;^)) so that it comes out exactly the size you want, without having to rescale or lose quality. Read these articles for info on print formatting with CSS:

If the image is just plain, not embedded in a page, you can't go this route, and you will have to rescale.
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:
Split the points between snoyes_jw and Squinky.

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

EE Cleanup Volunteer
All Courses

From novice to tech pro — start learning today.