Page 1 of 1

Traditional crop/delete other pixels, rather than hiding pix

Posted: 2012-06-29T18:56:49-07:00
by cjmi
So, I upgraded from ImageMagick 6.2.8/libtiff 3.8.2 to ImageMagick 6.7.8-0/libtiff 4.0.2.

On my old version, "convert someTiff.tif -crop 60x60+123+231 someTiffCropped.tif" did a traditional crop, which cut out a 60x60 pixel area from a large someTiff.tif file, at the 123, 231 coordinate.

On my new version, the same command crops to a 60x60 pixel area along the lines of the new Photoshop crop, where the other pixels are hidden in out of areas in the image. Results in a huge file.

Additionally, if I load this new version's cropped file in Photoshop CS6, it's showing me the 60x60 pixel area at the 0,0 coordinate -- not the 123, 231 coordinate. Either a bug in IM, libtiff, or PSCS6. Anyways, it doesn't matter to me in the end. :)

How can I tell ImageMagick/Magick++ to do a more traditional crop and delete the other pixels, rather than non-destructively hiding them? That should fix all my issues...

Re: Traditional crop/delete other pixels, rather than hiding

Posted: 2012-06-29T19:14:00-07:00
by fmw42
You probably need to add the command line equivalent of +repage to remove the virtual canvas. Which is probably -repage +0+0. You will need to find the API equivalent as I don't code in any API.

see
http://www.imagemagick.org/Usage/crop/#crop_repage

Re: Traditional crop/delete other pixels, rather than hiding

Posted: 2012-06-29T19:20:09-07:00
by cjmi
You rock. (You have ninja fast responses.)

Truth is I'm using Magick++ in c++, just was using convert to test why things were going wrong.

Tried adding "-repage 0+0" to convert options, didn't change anything.

For in c++, I searched for the phrase "repage" in /usr/local/include/ImageMagick, and in ~/sourceInstallations/ImageMagick-6.7.8-0/Magick++/lib, and found nothing.

Re: Traditional crop/delete other pixels, rather than hiding

Posted: 2012-06-29T19:24:04-07:00
by cjmi
There's another way to go about it. Is there a way to create an Image, from a given area in a different Image? That (should) avoid the hidden pixel problem I'm in now.

... Right now I'm doing:

Code: Select all

Image croppedImage = uncroppedImage;
croppedImage.crop(Geometry(60, 60, startX, startY));
... Which is sort of wasteful, but I'm not worried about program execution time.

Re: Traditional crop/delete other pixels, rather than hiding

Posted: 2012-06-29T19:39:54-07:00
by fmw42
cjmi wrote:You rock. (You have ninja fast responses.)

Truth is I'm using Magick++ in c++, just was using convert to test why things were going wrong.

Tried adding "-repage 0+0" to convert options, didn't change anything.

For in c++, I searched for the phrase "repage" in /usr/local/include/ImageMagick, and in ~/sourceInstallations/ImageMagick-6.7.8-0/Magick++/lib, and found nothing.
In command line your would add +repage just before the output.

Try looking for page or repage.

In command line you can specify the region of the image you want

convert image[WxH+X+Y] output

but I don't know anything about Magick++ or C++. Sorry.

Also look in your crop command to see if there are argunents for page or repage

Re: Traditional crop/delete other pixels, rather than hiding

Posted: 2012-07-04T18:29:31-07:00
by anthony
The read modifiers will work from other API's.
But I do not know if they do a automatic +repage. Probably not.