I was all set to write a custom cropping script using the crs:Crop settings in the XML profile by calculating those values as percentages of the original image dimensions. Then I noticed IM can read the profile using the -profile switch with an xmp: prefix on the profile filename. I tried running the command "convert abc005_L.CR2 -profile xmp:abc005_L.xmp abc005_L.tif" but the resulting tiff was uncropped. So is there a way for IM to automatically create a cropped version of a cr2 file on the command line (like I see when I open the cr2 in Photoshop) or will I have to go ahead and calculate the geometries and use them with a -crop switch as was my original plan?
crs:CropTop="0.342177"
crs:CropLeft="0.245271"
crs:CropBottom="0.830426"
crs:CropRight="0.776552"
crs:CropAngle="-0.450656"
crs:CropConstrainToWarp="1"
crs:HasCrop="True"
Thanks!
Cropping a CR2 file using the XMP profile
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Cropping a CR2 file using the XMP profile
Not automatically. In IMv7 you may be about to directly crop using the profile values, but in IMv6 you will need to use a script to first extract those values, and then call IM to do the crop. You may want to remove those profilvalues after cropping, though IM may not be able to do this. At least not at this time.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Cropping a CR2 file using the XMP profile
Thanks. I'm using IM6. I went ahead and wrote a script which was pretty easy after all. Good point about removing the profile values after cropping.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Cropping a CR2 file using the XMP profile
Be sure to use +repage after the crop to remove any old virtual canvas (page) information, so that it matches the new newly cropped image.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Cropping a CR2 file using the XMP profile
Hi aporthog, any chance you might be willing to share this script or the logic you used to convert the XMP crop values to IM crop area? Thanks!