changeset 1407:912b5631f2c4 new_scaling

fix new bug with output image not obeying dw and dh.
author robcast
date Mon, 19 Oct 2015 20:17:03 +0200
parents d98f760277b4
children 07914dfe7a4c
files common/src/main/java/digilib/image/ImageJobDescription.java
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/common/src/main/java/digilib/image/ImageJobDescription.java	Mon Oct 19 20:16:20 2015 +0200
+++ b/common/src/main/java/digilib/image/ImageJobDescription.java	Mon Oct 19 20:17:03 2015 +0200
@@ -483,13 +483,15 @@
                 // calculate dw
                 userImgArea = getUserImgArea();
                 double imgAspect = userImgArea.getWidth() / userImgArea.getHeight();
-                paramDW = (int) Math.round(paramDH * imgAspect);
+                // round up to make sure we don't squeeze dh
+                paramDW = (int) Math.ceil(paramDH * imgAspect);
                 setValue("dw", paramDW);
             } else if (paramDH == 0) {
                 // calculate dh
-                userImgArea = getUserImgArea();
+            	userImgArea = getUserImgArea();
                 double imgAspect = userImgArea.getWidth() / userImgArea.getHeight();
-                paramDH = (int) Math.round(paramDW / imgAspect);
+                // round up to make sure we don't squeeze dw
+                paramDH = (int) Math.ceil(paramDW / imgAspect);
                 setValue("dh", paramDH);
             }
         }