Dear James,
I tried the following code
R, G, B = 0, 1, 2
Image1 = img.split()
Image2 = img1.split()
outR = ImageMath.eval("(a + b)", a=Image1[R], b=Image2[R])
outG = ImageMath.eval("(a + b)", a=Image1[G], b=Image2[G])
outB = ImageMath.eval("(a + b)", a=Image1[B], b=Image2[B])
Image1[R].paste(outR, None)
Image1[G].paste(outG, None)
Image1[B].paste(outB, None)
out = Image.merge(img.mode, Image1)
I am using this code for adding the values of pixels from two different
images. But again I am getting the same error, as mentioned in my previous
mail. Only time I am not getting the error is when i am converting the
images to "L", before performing eval.
Please help me out, I dont know where I am wrong.
With Warm Regards,
Bishwarup
On Mon, Oct 19, 2009 at 4:49 PM, James Tedrick <[email protected]> wrote:
> use (image).split out the multi-band into the single bands and Image.merge
> again afterword- take a look at
> http://www.pythonware.com/library/pil/handbook/introduction.htm under
> "Cutting, pasting..."
>
> james
>
>
> On Mon, Oct 19, 2009 at 6:02 AM, Bishwarup Banerjee <
> [email protected]> wrote:
>
>> Dear James,
>>
>> Thank you very much for your reply. I tried that but i get the following
>> error
>>
>> ValueError, unsupported mode, P
>> I am trying to find a solution, it may be due to multi band image. In the
>> mean time If you have solution to this problem please reply back.
>>
>> With Warm Regards,
>> Bishwarup
>>
>>
>>
>>
>>
>>
>> On Fri, Oct 16, 2009 at 6:23 PM, James <[email protected]> wrote:
>>
>>>
>>> The ImageMath Module should take care of it (works on single-band
>>> images, which is what it sounds like you've got):
>>>
>>> (slight mod of demo)
>>> import Image, ImageMath
>>>
>>> im1 = Image.open("image1.jpg")
>>> im2 = Image.open("image2.jpg")
>>>
>>> out = ImageMath.eval("a + b", a=im1, b=im2)
>>> out.save("result.png")
>>>
>>> james
>>>
>>> On Oct 16, 3:32 am, Bishwarup <[email protected]> wrote:
>>> > Dear All,
>>> >
>>> > I am new to PIL and python. I am in the process of developing a plugin
>>> > for image processing. In this I need to modify each pixel of an image,
>>> > then combine the images to form a new image. The pixel values of the
>>> > new image will be summation of the pixel values of all the images at
>>> > that particular location.
>>> > Can this be achieved through PIl and python, If yes then how?
>>> > I am using PIL 1.1.6, python 2.5 and windows
>>> > Thank you in advance.
>>> > With Regards
>>>
>>
>>
>