Image orientation and color information with PIL?

Ivan Van Laningham ivanlan at
Mon Jul 18 18:55:42 CEST 2005

Hi All--

tvmaly at wrote:
> Does anyone know if it is possible to determine if an image is
> horizontal/vertical  and color or black & white using the python image
> library?  I have been searching this news group and the information was
> not all clear on this.

How are you going to determine the orientation of an image without
sophisticated image analysis?  I suspect Adobe Photoshop can do it, but
I don't know for sure.  You'd have to look for things like sky, or
clouds, overcast sky, people's faces, and so on and so forth.  It'd be
cool to have this available in Python, but unless the F-bot is busier
than I thought and working behind the scenes using his time machine,
it's not there now.

If you write it I'll use it;-)

Color vs B&W ought to be easy, though, by analysing the color table, if
there is one, and/or image mode.  Check the PIL documentation.  If you
have only searched the newsgroup then you might have overlooked the

Ivan Van Laningham
God N Locomotive Works
Army Signal Corps:  Cu Chi, Class of '70
Author:  Teach Yourself Python in 24 Hours

More information about the Python-list mailing list