diff options
| author | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2020-01-31 14:30:22 +0000 |
|---|---|---|
| committer | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2020-01-31 14:30:22 +0000 |
| commit | c5f2fd111e0933d2bab233ef0de9dde2f5da1e96 (patch) | |
| tree | 2d138cc3457634ed4ae95e600684d9899f7a66dd | |
| parent | Use the actual page size of the remarkable (diff) | |
| parent | Fix cropping bug that results in rotated pages (diff) | |
| download | paper2remarkable-c5f2fd111e0933d2bab233ef0de9dde2f5da1e96.tar.gz paper2remarkable-c5f2fd111e0933d2bab233ef0de9dde2f5da1e96.zip | |
Merge branch 'master' into feature/html-document
| -rw-r--r-- | paper2remarkable/crop.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/paper2remarkable/crop.py b/paper2remarkable/crop.py index d1a94d8..5f3b4e3 100644 --- a/paper2remarkable/crop.py +++ b/paper2remarkable/crop.py @@ -139,6 +139,15 @@ class Cropper(object): # This is the bounding box in PIL format: (0, 0) top left x0, y0, x1, y1 = left, top, W - right, H - bottom + # The remarkable changes the orientation of a portrait page if the + # width is greater than the height. To prevent this, we pad the height + # with extra whitespace. This should only occur if the original + # orientation of the page would be changed by cropping. + w, h = x1 - x0, y1 - y0 + if H > W and w > h: + y1 = y0 + w + 10 + h = y1 - y0 + # Get the bbox in Ghostscript format: (0, 0) bottom left a0, b0, a1, b1 = x0, H - y1, x1, H - y0 return [a0, b0, a1, b1] |
