[Image-SIG] Setting DPI field when saving a PNG file

Dave Lajoie dave.lajoie at autodesk.com
Wed May 6 23:11:01 CEST 2009

Hello Everyone!
I am attempting to save a PNG file, where the source file doesn't have dpi fields.
What is the proper way to enforce a new DPI with .save() function?

I have attempted to modify the .info dictionary by adding a dpi entry, but it never gets saved for some reason.
I am missing something really obvious here. :)

import Image
print "Loading Demo.png"
im = Image.open("C:\\Demo.png")
print "Demo.png Info:\n"
print im.info
print "________________________"
print "Changing Demo.png dpi to 72"
print "________________________"
print "Demo.png Info:\n"
print im.info

Thanks for your help.

More information about the Image-SIG mailing list