You are here: Re: work with images « PHP Programming Language « IT news, forums, messages
Re: work with images

Posted by Sandman on 12/11/05 12:21

In article <1134292976.906952.307970@g14g2000cwa.googlegroups.com>,
"NurAzije" <nurazije@gmail.com> wrote:

> Hi,
> I wonder is there a way or a function to take a high resolution image
> and change it to low resolution ?? I have a directory with a 200
> pictures, and want to save them with the same width and height but with
> another lower resolution, can I do it automaticly with a script, not
> downloading them, changing them with image program and uploading them
> again..

You say you want to keep the width/height and change the resolution, which
sounds like if you want to change the DPI. This will not alter the images size
on disk at all. DPI is just a numerical value attached to an image that lets a
printer know how big it should be on paper.

As long as the pixels are the same, DPI doesn't change anything. I.e. a 200x200
pixel large image in 72 dpi is the exact same size as a 200x200 pixel large
image in 300 dpi.


Generally, though, when you talk about high/low resolution images on the web,
you are indeed talking about the image width/height in pixels. I.e. a very
large image on the web makes for printing in a higher resolution than a smaller
one.


So, the question is, when you say "the same width and height", do you mean in
pixels or a real world measurement (i.e. inches/centimeters)?

Because, if you mean in inches (as in the image being 300x300 and it's in 300
DPI and thus prints as a one-inch square on paper) you can calculate the new
pixel ratio for each image to your new resolution.


So:

300x300 pixels @ 300 dpi = 1 inch^2
150x150 pixels @ 150 dpi = 1 inch^2

So, you have to lower the DPI along with the amount of pixels to keep the end
result intact.

PHP doesn't, as far as I know, have any tools to deal with DPI information in
images. You might want to have a look at ImageMagick.


--
Sandman[.net]

Edwin, on protecting against malware:
"I use Avast AV, the Yahoo anti-spy toolbar, the MS anti-spy software,
Windows SP2 with its firewall, AdAware, Spybot Search and Destroy, and
SpywareBlaster."

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация