Daniel Guerrero Thoughts

Thursday, June 03, 2004

Lambda

I love Python!

I was testing one filter which study today in the morning and I want to see in action the code using Python Imaging is really, really simple to implement point functions, just check the code:


def apply_sin(image, side=0):
if not side:
return image.point(lambda x: 255
* math.sin((x*math.pi)/510))
else:
return image.point(lambda x: 255
* (1 - math.cos((x*math.pi)/510)))


This is for an algorithm of brightening and the second is for obscuring, I want to make a little graphical program which implements this algorithms, the question is... I must keep doing in Python?, I want to give it also as my final project in other course, but I don't think it will accept the Imaging Library, so I have to reimplement all; I want to use GdkPixbuf, the problem I have seen is handling grayscale images, because GdkPixbuf save the file as RGB using RGB palettes, instead of trying saving in grayscale palettes.

Of course, I can only use it and forget about how it saves; it will not matter to my teacher =)

1 Comments:

Post a Comment

<< Home