Posts: 1,231
Threads: 194
Joined: May 2015
Reputation:
13
When a song page from a (possibly larger) PDF is cropped, this is registered in the database table Crop.
I was wondering what the exact interpretation of the values for Left/Top/Right/Bottom is.
I'd like to use these values for an external tool to apply the same crop to the pages.
Johan
johanvromans.nl — hetgeluidvanseptember.nl — mojore.nl -- howsagoin.nl
Samsung Galaxy Note S7FE (T733) 12.4", Android 13.0, AirTurn Duo & Digit (Gigs).
Samsung Galaxy Note S4 (T830) 10.5", Android 10.0 (maintenance and backup).
Samsung A3 (A320FL), Android 8.0.0 (emergency).
Posts: 1,047
Threads: 112
Joined: Dec 2015
Reputation:
11
That's interesting. Maybe these coordinates can be exported and used for another import by csv? Kind of saving the crop data without a full backup?
Posts: 13,357
Threads: 301
Joined: Apr 2012
Reputation:
235
They are the coordinates relative to the file page dimensions. So to use them, you will need to open the file and read the size of the page.
Posts: 1,231
Threads: 194
Joined: May 2015
Reputation:
13
This is what I thought, but the numbers just do not match.
For example, in one of my PDFs all pages have the same dimensions (mediabox 597.0 x 828.0). In the Crop table I see typical values of 596 and occasionally 598 (right) and 824 and 827 (bottom).
For page dimensions, do you use MediaBox, CropBox, BleedBox, TrimBox or ArtBox?
Johan
johanvromans.nl — hetgeluidvanseptember.nl — mojore.nl -- howsagoin.nl
Samsung Galaxy Note S7FE (T733) 12.4", Android 13.0, AirTurn Duo & Digit (Gigs).
Samsung Galaxy Note S4 (T830) 10.5", Android 10.0 (maintenance and backup).
Samsung A3 (A320FL), Android 8.0.0 (emergency).
Posts: 1,231
Threads: 194
Joined: May 2015
Reputation:
13
(07-05-2017, 05:27 AM)BRX Wrote: That's interesting. Maybe these coordinates can be exported and used for another import by csv? Kind of saving the crop data without a full backup?
Exactly
Johan
johanvromans.nl — hetgeluidvanseptember.nl — mojore.nl -- howsagoin.nl
Samsung Galaxy Note S7FE (T733) 12.4", Android 13.0, AirTurn Duo & Digit (Gigs).
Samsung Galaxy Note S4 (T830) 10.5", Android 10.0 (maintenance and backup).
Samsung A3 (A320FL), Android 8.0.0 (emergency).
Posts: 13,357
Threads: 301
Joined: Apr 2012
Reputation:
235
I use the MediaBox for the page dimensions. i believe I am setting the right value of the crop rectangle to pageWidth - 1 and the bottom value to pageHeight - 1 if you drag the cropping boxes all the way to the edges of the page. If you clear the cropping, I set it to 0,0,0,0, so that's how you can identify when no crop has been applied. During some of my processing, if I calculate that cropping was applied, I set pageWidth = width of the cropping box + 1, and pageHeight = height of the cropping box + 1, and verify that I haven't exceeded the raw page dimensions (otherwise I clamp).