[Tutor] identifying graphics attributes

Andy W toodles@yifan.net
Tue, 26 Feb 2002 10:14:49 +0800

Hi Eric,

> Is there a resource I could look to for information about using Python
> to "examine" graphics files (like Photoshop or Illustrator documents)?
> This will need to run on Mac OS 9, though that can be worked around if
> necessary (I have Unix and windows machines at my disposal as well).  I
> would appreciate any input that anyone can give -- I know it seems like
> a pretty big project to tackle right off the bat, but I'm really
> interested in the plausibility of something like this.

Have you looked at PIL?

Something simple like the following can be done to get the size of an image,
with PIL:

import Image
print picture.size

The binaries are only in Windows format, but the source is there.
I'm not sure how many different file formats it supports, but I tried BMP,
JPG, GIF and PNG. They were all successful.

I hope this makes your task easier!

Good luck.

> Thanks very much
> Erik
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor