Good evening,
I have looked through the examples and scrounged over the IM docs for Magick++ and haven't found a concrete way of determining a particular layers x,y offsets in relation to the background (ie. if background is 1000x1000, layer 1 is 250x250 at +50+20). Command line "identify" is usually able to extract geometry from the image including these variables, but I can't seem to find anything in the IM docs that points me in the right direction besides perhaps using the Magick::Pixels::getPixels() method, but I am not sure how these coordinates might be in relation to the image as a whole, or in relation to only the previous layer.
Thoughts?
Determining layer offset geometry in Magick++
Re: Determining layer offset geometry in Magick++
Have you tried image.page()? There is also a Magick::Options::page() method.
Re: Determining layer offset geometry in Magick++
Ahhhh nice image.page() actually worked perfectly! I guess I didn't quite get from the documentation that it returns a Geometry object.
Just for anybody else that's reading this in the future, I used the following:
int i, c;
list <image> image;
readImages(&image, img_name.c_str());
c = image.size();
for(i=0;i<c;i++)
{
image.pop_front(); // So I don't read the merged image "layer"
std::cout << "x: " << image.front().page().xOff() << "y: " << image.front().page.yOff() << endl;
}
Just for anybody else that's reading this in the future, I used the following:
int i, c;
list <image> image;
readImages(&image, img_name.c_str());
c = image.size();
for(i=0;i<c;i++)
{
image.pop_front(); // So I don't read the merged image "layer"
std::cout << "x: " << image.front().page().xOff() << "y: " << image.front().page.yOff() << endl;
}
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Determining layer offset geometry in Magick++
See the discussion about -geometry offsets vs -page offsets in IM Examples, Composition
http://www.imagemagick.org/Usage/compose/#geometry
http://www.imagemagick.org/Usage/compose/#geometry
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/