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 :
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;
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!