Is it possible to change a picture resolution with Python?
Max Erickson
maxerickson at gmail.com
Wed Sep 20 18:52:29 EDT 2006
"Lad" <python at hope.cz> wrote:
> from
>> image:
>> http://www.pythonware.com/library/pil/handbook/image.htm
>>
>> This is some example code:
>>
>> from PIL import Image
>> im = Image.open("1.jpg")
>> nx, ny = im.size
>> im2 = im.resize((int(nx*1.5), int(ny*1.5)), Image.BICUBIC)
>> im2.save("2.png")
>>
>> Bye,
> bearophile,
> 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?
> Thank you
>
If you just want to change the dpi flag that some software uses to
interpret the size of the image when rendering it, something like:
im.save('c:/tmp/out.jpg', dpi=(100,100))
might work. You can get lots of info on why this doesn't really change
the resolution of the image from google.
max
More information about the Python-list
mailing list