determining offset in magick++ crop operation
Posted: 2012-06-21T05:44:37-07:00
As part of a larger program, I'm using imagemagick+jpegtran to hack up a "lossless" jpeg trim operation. Essentially, I run a trim operation, take the results, and then apply it through jpegtran (after altering the math a bit to fit within jpegtran crop constraints). I am in the process of updating the program from more or less simple scripting (running an external imagemagick executable) to proper magick++ API, to increase the speed/lower resources used. Unfortunately, while I can do it with the executable, I can't seem to find the information I need within the API. Using :
Output:
I can find out the original and post-crop resolutions, but I can't seem to find the offset it was cropped at. granted, i could just color a pixel at the top, trim, note, and repeat for bottom, left, and right. but that's a lot more work to do something I'm sure is available somewhere (given that you can access it from the commandline).
Any help would be much appreciated!
Code: Select all
Image file(input);
file.colorFuzz(fuzz*65535/100);
file.trim();
cout << "ores: " << file.baseColumns() << "x" << file.baseRows() << endl;
cout << "nres: " << file.columns() << "x" << file.rows() << endl;
Code: Select all
ores: 1548x1084
nres: 512x656
Any help would be much appreciated!