Re: Convert from jpg to gif ... change dpi...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




<tg-php@xxxxxxxxxxxxxxxxxxxxxx> wrote in message news:E1Fd74o-0006pQ-Lr@xxxxxxxxxxxxxxxxxxxxx
Actually I don't believe this is exactly right.... from playing around with Photoshop you can see that you change an image's resolution under Image -> Image Size and if you turn off "Resample Image", it will retain the same pixel dimensions.

GIF's are limited to 72dpi (or ppi if you prefer.. pixel per inch) which matches what is typically displayable or desirable for web content. But when you go to print that webpage, you really see the lack of quality in that GIF image.

If you use a JPG and set it for around 300 dpi/ppi, it prints out a LOT nicer.


So there's a real easy answer to this question... yes, you can change DPI on the fly when converting JPG -> GIF... the downside is that you're converting to 72dpi whether you like it or not because that's the GIF standard.

If somebody has more or better information on this, I'd love to hear it but this is how it is as far as I know and have experienced.

Well, still a learner on the PHP front but as far as images are concerned, just a bit more knowledgeable.

First off, DPI is not a function within an image, it is a function of output and is governed by a combination of the programme doing the output and the device it is being output to.

So, to make things clearer, let's take an actual example.

We have an image - we'll call it 'image_A' of size (in pixels) of 3000 x 2000. If you want to output that image to a printer (which has a resolution of 300lpi) you will get an image size of 3000/300 x 2000/300 = 10 x 6.67 inches. But the image is still 3000 x 2000 pixels. If you want to output it to a printer with 600lpi resolution then it will print an image size of 3000/600 x 2000/600 = 5 x 3.33 inches and still, the real image size is 3000 x 2000 pixels. However, if we look at it from the viewpoint of the application (rather than the printer), we can see a slightly different perspective on the same data: If we already know that the resolution of the output device (in this case a printer) is 300lpi and we know that we want the printed image to measure 10 x 6.67 inches then we can set the dpi within the application (Photoshop or whatever, that, when it comes to print the image, we want it to "tell" the printer to print the image at a resolution of 300lpi. If we know that we want to print the image at a size of 5 x 3.33 inches (on that same 300lpi printer) then the application will know that the output resolution to produce that image size *should* be 600lpi. However, the printer is only 300lpi so what takes place is called interpolation where 2 pixels within the application is are output as 1 pixel to the printer.

However, monitors typically don't have anywhere near that resolution (typically they are around 72 - 96 dpi) so that same 3000 x 2000 pixel image is now going to a different output device (the monitor) at 96 dpi, so the image size now output on-screen is 3000/96 x 2000/96 = 31.25 x 20.83 inches - which is way bigger than any current monitor (although you could, perhaps, use multiple displays), so, in order for the image to display at a reasonable size on screen, we need to reduce the image SIZE to take account of the SCREEN dpi (96dpi). This means that for the image to display at a size of 300 x 200 pixels on a screen (of resolution 96 dpi) we need to make the image SIZE: 300 x 200 pixels. However, if we want to display the image at a size on screen of, say, 6 inches x 4 inches, then we need to do the calculation for the required image size: (6 x 96) x (4 x 96) = 576 x 384 pixels.

The screen resolution likewise is a function of the number of pixels (of the screen) and the size (in inches) of the screen:

screen width: 1024 pixels - 13.2 inches; then dpi = 1024/13.2 = 77.5dpi
screen width: 1280 pixels - 13.2 inches; then dpi = 1280/13.2 = 96 dpi

etc.

So, in conclusion, the DPI of an image is an OUTPUT function - it is not inherent to the actual image. However, you may see DPI data stored within the metadata of a file, where it has been stored by the application used to edit it, because the application has stored information you have given it to communicate with (usually) the printer. It serves no other purpose.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux