Sign in to follow this  

How do i subtract one image from another using C++

This topic is 4169 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Please, anyone, how do i subtract one PNG image from another PNG image. The images are of the same scene, but with just some additional few differences in one of them. The result of the subtraction will be stored in another PNG image. There are lots (hundreds) of such pair of images popping up every now and then, So i can't do them manually. Not even on the command line. I have got to do it using C++, but my seach so far has yeilded nothing, not even in the magick++ forum. Has anyone got any clues please, with some c++ (or preferably magick++ so i would know how to actually access the pixels/bytes in order to do the subtraction)?

Share this post


Link to post
Share on other sites
Hi,

Well first you would need to load the png in to get their bitmap data (using pnglib for instance). Then iterate over the bits and substract as you go. Write that to some other png file.

Greetings

EDIT: that would be libpng btw... www.libpng.org
Here you can get an api to get the bitmap data of a png

Share this post


Link to post
Share on other sites

This topic is 4169 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this