Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A script to create IMG tags from a folder of pictures' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A script to create IMG tags from a folder of pictures
Authored by: guybrush on Dec 22, '04 05:18:32PM
the python script uses an external command "sips" to get the width/height of the image, but OS X supports Quartz commands in python. Taken from /Developer/Examples/Quartz/Python/image.py:
from CoreGraphics import *

i = CGImageImport (CGDataProviderCreateWithFilename (inputFile))
print "Image '%s' size is (%d,%d)" % (inputFile, i.getWidth(), i.getHeight())
works great, has other nice features as well, just check the /Developer/Examples/Quartz/Python dir :)

[ Reply to This | # ]