change dpi without changing pixels dimensions with PIL?

Gustavo Campanelli birdiepageANTI at
Wed Dec 17 15:45:46 CET 2003

duikboot wrote:
> Hi there,
> In Photoshop I can, when I want to change the dpi(dots per inch) of a
> picture, arrange that the picture won't be resized. Do you know of a way, I
> can accomplish this in python with PIL? If I use this script it changes the
> dpi, but the picture becomes huge.
> Thanks

I might be completely wrong, but I think you have an error here. 
Basically, a monitor has a set resolution (the resoultion at which you 
run your graphics card). That resolution has a certain number of dots 
per inch. So, if you increase the dots per inch of an image, you are 
making it bigger and will require more monitor space or page area to 
show or print it. What you are doing with Photoshop, most probably, is 
increase the Dots Per Inch (DPI) AND rescaling it only for viewing 
purposes on your screen. So although you see it the same size, the 
picture surely is bigger. If that's the case, your script is doing what 
it's supposed to do, but you need to "fit to screen" or something like 
that if you want it to remain the same size ONLY for viewing purposes.


More information about the Python-list mailing list