Hello everyone, I have some coding experience in Python but I'm new at PyS60.
Now, I'm on a project as they are a Good way to learn new things dynamically.
My target is to make an invert color filter,
What I've done is
The colors are Successfully getting inverted,Code:from graphics import * import e32 s=raw_input("Enter Image Location \n=") im=Image.open(s) img=Image.new(im.size, "L") #my need is to make it B&W then invert img.blit(im) img.save("E:\\F.jpg") print "F.jpg has been generated" def invertclr(img2): width, height= img2.size img3=Image.new(img2.size, "L") for y in range(height): for x in range(width): c=img2.getpixel((x,y))[0] r,g,b=c img3.point((x,y), (255-r, 255-r, 255-r)) #e32.ao_yield() img3.save("E:\\F2.jpg") invertclr(img) print "E:\\F2.png has been generated"
But it takes Long times to do it
Inventing An Image of 477x535 needed 41 seconds
But I have an feeling that it can be done in 1 or 2 seconds,
Actually, when I Make an B&W image an Invert its colors, and if this image is used as a mask. It creates a pretty good image filter.
Any kind of help will be appreciated.
EDIT: removing the e32.ao_yield inside the loop (now commented) reduced the time by 11 seconds, but its still not quite enough.
will it run fast inside a class or a compiled script??



Reply With Quote


