Question

I'm working with the Magick++ API and I'm trying to figure out how do I read in one image, and perform two different kinds of effects and save each out into a different image. Right now what I'm doing is reading in an image and warp/distort it along a circle path and saving that new one (image-warped.ext). This works great. My next step now is to also create another image that's a mirror flop. So read in a 400x400 pixel image, flop it along the right edge so I end up with an image that's 800x400 and then save that out.

How do I do that with the same original image object I just read in? I can't imaging having to go back and reread the original image again, after all it's already in memory. Or am I mistaken?

Thanks!

Was it helpful?

Solution 2

Discovered that I can simply pass it:

Magick::Image originalFile;
originalFile.read("file.png");

Magick::Image clonedFile = originalFile;

At this point I have both originalFile and clonedFile. I can treat each one separate.

Source: http://www.imagemagick.org/Magick++/Image.html - second example down.

OTHER TIPS

I think you are looking for the CloneImage() function. Read it in, clone it, work on one and output, then work on the clone.

That's the way the command-line tools work too... see here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top