Adding 2 images and looping values?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
PandoraBox
Posts: 23
Joined: 2011-04-10T14:08:11-07:00
Authentication code: 8675308

Adding 2 images and looping values?

Post by PandoraBox »

Hello everyone,
just a quick question as I'm working on a GUI for Imageagick in python using PAGE and I'm working on some plug-in effects (The tool is going to be a total freebie) my question is can something like this be done :

pixel 1 on image 1 and pixel 1 on image 2.

200,200,200 image 1 pixel 1
127,127,127 image 2 pixel 1

To make image 3 pixel 1 the value of 200+127 = 327-255= 72

To get 72,72,72 as the pixel value in other words combining 2 images but looping the excess I can do this manually with imagej and excel but it's a pain in several places.

All the help is greatly appreciated.

PandoraBox
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Adding 2 images and looping values?

Post by snibgo »

I don't understand the question. I think you want to add two images, taking the result modulus the Quantum.

The compose setting ModulusAdd does what you seem to want, eg:

Code: Select all

convert xc:rgb(200,200,200 xc:rgb(127,127,127) -compose ModulusAdd -composite txt:

# ImageMagick pixel enumeration: 1,1,65535,srgb
0,0: (28.2353%,28.2353%,28.2353%)  #484848484848  srgb(72,72,72)
In this example, both images have only one pixel. They can be any size you want, of course.
snibgo's IM pages: im.snibgo.com
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Adding 2 images and looping values?

Post by glennrp »

ModulusAdd is missing from http://imagemagick.org/script/compose.php but it does appear in the "-list compose" output.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Adding 2 images and looping values?

Post by fmw42 »

Post Reply