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...
Traditional crop/delete other pixels, rather than hiding pix
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Traditional crop/delete other pixels, rather than hiding
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
see
http://www.imagemagick.org/Usage/crop/#crop_repage
Re: Traditional crop/delete other pixels, rather than hiding
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.
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
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:
... Which is sort of wasteful, but I'm not worried about program execution time.
... Right now I'm doing:
Code: Select all
Image croppedImage = uncroppedImage;
croppedImage.crop(Geometry(60, 60, startX, startY));
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Traditional crop/delete other pixels, rather than hiding
In command line your would add +repage just before the output.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.
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
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Traditional crop/delete other pixels, rather than hiding
The read modifiers will work from other API's.
But I do not know if they do a automatic +repage. Probably not.
But I do not know if they do a automatic +repage. Probably not.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/