Is it possible to change a picture resolution with Python?

Diez B. Roggisch deets at nospam.web.de
Wed Sep 20 13:17:23 EDT 2006


> Thank you for your reply.
> But the above code increases size only , but not DPI resolutions(
> vertical nad horizontal).I need  a higher  vertical and horisontal
> resolutions.
> Any idea how to do that?

The DPI is nothing an image contains by itself - it depends on the
resolution of the rendering device!

So - without knowing what DPI the output device produces, and which
resolution the image was acquired in, you can't do anything.

If you know these two quantities, you can scale the image by the appropriate
amount.

Bearophile suggested that there might be a DPI-information stored in the
image itself. If so, it is hopefully the DPI the image was e.g. scanned in.
But if you for example afterwards scaled it by half, this information must
be altered accordingly, to reflect the changes.

Diez



More information about the Python-list mailing list