IANAGE (I Am Not A GD Expert), but as far as I know the GD functions dealing
with image size don't concern themselves with the resolution of an image in
terms of dots per inch, just with the number of pixels.

Since most uses of the GD library functions in PHP will have to do with
creating/manipulating images to send to the browser, it should be safe to
assume that any image created with PHP will be 72 DPI.

If you're talking about resizing a much larger image (for instance, a 3.5
inch by 5 inch JPEG created at 300 DPI), you just need to do some math to
figure out how much to shrink it.

If your source resolution is 300 DPI and your target resolution is 72 DPI,
you need to multiply the number of pixels in the width and height of the 300
DPI original by a factor of 72/300, which equals .24.

Or to put it another way:

5 inches at 300 DPI = 1500 pixels.

5 inches at 72 DPI = 360 pixels.

1500 pixels * .24 = 360 pixels.

I hope that wasn't utterly confusing, but IANAMT (I Am Not A Math Teacher),
either. :P

You'll probably want to take a look at the imagecopyresized and
imagecopyresampled functions:

http://www.php.net/manual/en/function.imagecopyresized.php
http://www.php.net/manual/en/function.imagecopyresampled.php

(Imagecopyresampled produces much nicer results, but it's only available in
4.06 and later.)

-Andy

> -----Original Message-----
> From: Andy [mailto:[EMAIL PROTECTED]]
>
> I would like to create images with 72 dpi with gdlibrary2.01
>
> Is this possible?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to