Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Python
addendum Re: working with images (PIL ?)
 

Index | Next | Previous | View Flat


znfmail-pythonlang at yahoo

May 14, 2008, 11:35 AM


Views: 144
Permalink
addendum Re: working with images (PIL ?)

I've put together some code to demonstrate what my goal is though looping
pixel by pixel it's rather slow.

import Image

def check_whitespace():
im = Image.open("\\\\server\\vol\\temp\\image.jpg")

size = im.size

i = 0
whitePixCount = 0
while i in range(size[1]):
j = 0
while j in range(size[0]):
p1 = im.getpixel((j,i))
if p1 == (255, 255, 255):
whitePixCount = whitePixCount + 1
if whitePixCount >= 492804: ## ((image dimensions 1404 x
1404) / 4) 25%
return "image no good"
j = j + 1
i = i + 1

print whitePixCount

return "image is good"

print check_whitespace()


"Poppy" <znfmail-pythonlang[at]yahoo.com> wrote in message news:...
>I need to write a program to examine images (JPG) and determine how much
>area is whitespace. We need to throw a returned image out if too much of it
>is whitespace from the dataset we're working with. I've been examining the
>Python Image Library and can not determine if it offers the needed
>functionality. Does anyone have suggestions of other image libraries I
>should be looking at it, or if PIL can do what I need?
>


--
http://mail.python.org/mailman/listinfo/python-list

Subject User Time
addendum Re: working with images (PIL ?) znfmail-pythonlang at yahoo May 14, 2008, 11:35 AM
    Re: addendum Re: working with images (PIL ?) ivan.illarionov at gmail May 16, 2008, 6:48 PM
    Re: addendum Re: working with images (PIL ?) straton at lampsacos May 17, 2008, 6:24 PM
        Re: addendum Re: working with images (PIL ?) straton at lampsacos May 18, 2008, 5:05 AM
        Re: addendum Re: working with images (PIL ?) znfmail-pythonlang at yahoo May 19, 2008, 7:18 AM
            Re: addendum Re: working with images (PIL ?) straton at lampsacos May 19, 2008, 10:00 AM
                Re: addendum Re: working with images (PIL ?) znfmail-pythonlang at yahoo May 20, 2008, 9:04 AM
            Re: addendum Re: working with images (PIL ?) ivan.illarionov at gmail May 20, 2008, 1:13 AM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.