Page 1 of 1

increasing image / text resolution in GD

Posted: Thu Jun 19, 2008 11:28 am
by giles
Hi all,

I'm trying GD out for the first time. Here's my issue.

I'm interested in using GD to turn text into an image that I can then rotate by 90 degrees (as a way round browsers not being able to handle vertical text). It all works but the final image resolution appears to be somewhat low ... I guess the standard 72dpi. Trouble is that this image is going to placed adjacent to normal HTML text, which is going to render anywhere between 300 to 1200 dpi when printed on a nomal desktop printer .... so (you guessed it) my GD text looks aliasing and raggady next to my HTML text.

Is there anyway that I can get GD to render at a higher DPI so I can try match the quality?

Re: increasing image / text resolution in GD

Posted: Thu Jun 19, 2008 1:17 pm
by onion2k
Nope. You're stuck with 72dpi. Browsers can really only display 72dpi images anyway though, so it's not really a problem most of the time.

You can 'fake' it by making a much larger image and then downsampling it with imagecopyresampled(), essentially a cheap way of doing anti-aliasing, but it's not perfect.

Re: increasing image / text resolution in GD

Posted: Fri Jun 20, 2008 5:10 am
by giles
thanks for your reply.You mention your fix as a 'cheap' way ... I'm wondering if there is an 'expensive' way? (I've tried your suggestion and Aliasing is still apparent)

Re: increasing image / text resolution in GD

Posted: Fri Jun 20, 2008 5:38 am
by onion2k
The expensive way is to write your own anti-aliasing code. It's also the really, really hard way.

Re: increasing image / text resolution in GD

Posted: Fri Jun 20, 2008 6:04 am
by Kieran Huggins
I've found that the issue is often solved by using imagecopyresampled() instead of imagecopyresized()