Re: How does one obtain the resolution of an image in PHP?

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

 



Hi!

On Fri, 17 Mar 2006 10:58:12 -0500
John Hinton wrote:

> - Edwin - wrote:
> > Hi!
> >
> > On Thu, 16 Mar 2006 14:31:38 -0500
> > John Hinton <webmaster@xxxxxxxx> wrote:
> >
> >   
> >> Simon M. Campden-Main wrote:
> >>     
> >>> Well, there's the meat of it, isn't it?  I wonder how Paint
> >>> Shop Pro comes up with PPI (Image - Image information). 
> >>> I have several thousand scanned images with resolution
> >>> ranging from 72 PPI up to 1200 PPI (As reported by Paint
> >>> Shop Pro) and want to discard, or more likely tag as
> >>> rejected, any that suffer a resolution of less than 150
> >>> PPI.  As you might imagine, I find the thought of
> >>> doing it manually with Paint Shop Pro repugnant.
> >>>       
> >
> > Okay, if it was scanned at 72ppi then you can't really print
> > it out again even with a near-similar quality. However, having
> > an image with a 72ppi does NOT necessarily mean that you
> > have an image unsuitable for printing.
> >
> >   
> >> PPI or pixels per inch is a printing term.
> >>     
> >
> > Last time I checked, "dpi" is the printing term. (^_^)
> >
> >   dpi (dots per inch) -> printer
> >   ppi (pixels per inch) -> monitor/screen
> >
> >   
> Still missing it.. Yes, dpi is a printing term.. but has absolutely 
> nothing to with with images. dpi or "Dots per Inch" is purely a

I beg to differ... (see next)

> term that describes the limits of your printer. If for instance, we
> are talking about an ink jet printer with a 600 x 600 dpi
> capability, with black and three colors, that printer can print any
> of the four color or not print in a space 1/600th of an inch as it
> moves along. And there is no blending within that one dot... it's
> simply one of the colors or left the white or the paper color.
> 
> One might think that an image should be scanned at 600 dpi to
> provide and equal quality, but really you can scan at a much
> reduced resolution and get the same results with a basic inkjet

At a "much reduced resolution"? Try scanning some photo, say
an A3 size photo, at 72ppi. Then, try printing that at 600dpi on
the same A3 size paper and see what you get.

> color printer, because the scan will most often be done at 16.7
> million colors.. the printer only has 4(+paper color) so it really
> takes a 4x4 dot area or so to start to get close to matching a
> single pixel. Now, lets don't even go there on printers. The above
> is greatly understated and was how old inkjets worked.. much has
> changed and I really haven't followed exactly what they are doing
> now, but obviously it seems that there is a blending over top of
> other colors in today's printers..... Just trying to provide simple
> theory, quick to type, easy to grasp.

Add to that that some have 8(+paper color). And that not all
people are using inkjets.

> So, yet still ppi is being misrepresented.. Please stop doing this.

Who is misrepresenting what? ;-)

> If you don't believe me try this. Open a quality paint program. In
> fact, Macromedia's Fireworks in the image sizing dialog  box
> separates pixel dimensions from ppi putting ALL ppi function under
> the heading of "Print Size". The example.....
> 
> Open or create an image 600 pixels x 300 pixels.
> 
> Make sure you stay at 100% zoom factor.
> 
> Set the printing Pixels/Inch to 150, but don't let the program
> change the Pixel dimensions. You will be given a print size of 4" x
> 2". The image will take up 600 x 300 pixels of your monitor screen
> space.
> 
> Now with that same image, change only the resolution to 300. Leave
> the pixel dimensions the same (one has to be careful with the
> locking of proportions and samplings to be sure the program doesn't
> change the pixel dimensions when changing the Pixel/Inch). You will
> now see that the print size is 2" x 1", but yet the image size on
> the screen has not changed sizes.

Of course!

> A pixel is a pixel to a monitor. A pixel is sent thru an algorithm
> on the way to a printer and by and large, print quality has to be
> much greater than monitor quality to 'look' as good. Basically, you
> can't get a 4" wide image on the screen to look as good when
> printed at 4" wide.

That's correct. And nobody said otherwise.

> A general guideline is images for print should be no less than 150
> ppi, newspaper quality, and 300 to 600 is recommended for color
> brochures and "near photo quality". So, using our example above and
> assuming the printing company has requested 300 ppi images, that
> image at 600 x 300 which fills a major portion of one's monitor
> screen, can only be printed under this constraint at a maximum of 2
> inches x 1 inch. If you're going to print, check with the printer
> before beginning as print quality is generally rising at all levels.
> 
> The question of throwing away all images with 72dpi is irrelevant.

  72dpi !== 72ppi

Just to make it consistent, an image on the screen cannot have
a "dpi" whereas a *printed* image can.

> The questions are:
> What resolution, pixels per inch, do you want to print at? Lets
> assume 300. What size are the images in pixels? Lets assume 1200 x
> 900. (I know, odd size but easy math to follow)
> Are you happy with printing these images at 4 inches x 3 inches?
> ((1200 pixels / 300 pixels per inch = 4 inches) x (900 pixels / 300
> pixels per inch = 3 inches))
> If yes, keep the image.

Yes, and that's what I implied above. (See the part where I said,
"Having an image with a 72ppi...")

> If you started with an 8 x 10, scanning at 72dpi and are happy with 
> 150ppi, you can get a good print out at 4 x 5. If you want 300ppi,
> then 2 x 2.5 inches.. and so on.....

Pls. don't mix it. It should be 72ppi, 150dpi, 300dpi respectively.

> Also, if working in .jpg filetypes, there is normally a quality
> setting in the paint program. If you're going to print, set it to
> the highest. If to the web, medium to medium high is generally not
> a noticeable difference. My testing showed that these settings
> affect the number of colors in the image. Yes, we have 16.7 million
> to work with, but if you do a 'count colors' you'll normally find
> the image has 50 to 80 thousand colors or less. Setting the quality
> lower reduces this number which somehow reduces the filesize (I
> have no idea how the data is stored in a jpg file). And the
> algorithms used by the various paint program vary widely. This is
> where quality programs shine and cheaper ones show a lesser
> quality... generally.

Again, I beg to differ. I'm pretty sure that using The GIMP to
save JPEG files is not at all different saving the same file
using Adobe Photoshop or Macromedia's Fireworks, etc. And
you can check their price difference ;-)

> I was told by a Canon rep, that a 5megapixel image is the size
> needed to get the best print from their best consumer grade photo
> printer while printing an 8 x 11. That mathematically divides out
> to just under 300 ppi... so it makes sense.
> 
> So, an image which is 600 pixels x 300 pixels is going to display
> on screen as 600 pixels by 300 pixels regardless of printer dpi or
> ppi.

Correct. And again nobody said otherwise. :-)

> Sorry as this is really off topic, but it seems to be a basic
> missed by so many who are ultimately creating web pages.
> 
> And yes, do look at the powers within ImageMagik, which is
> installed on most 'nix systems. There are hundreds of simple
> command line functions available for use within PHP. ImageMagik
> also does a good job of optimizing images for web use. Their
> website provides a list of most if not all of these functions.
> 
> http://www.imagemagick.org/script/command-line-tools.php
> 
> Best,
> John Hinton
> 

HAND,

- Edwin -

-- 
"May a stranger, and not your own mouth, praise you;
 may a foreigner, and not your own lips, do so." - Proverbs 27:2

-- 
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