changeset 1418:849a06d55cc6

trying to fix bug when using prescaled images and only either dw or dh. (this is turning into a mess :-( )
author robcast
date Mon, 26 Oct 2015 13:23:48 +0100
parents e6ad329cfac8
children 18690b59687e
files common/src/main/java/digilib/image/ImageJobDescription.java
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/common/src/main/java/digilib/image/ImageJobDescription.java	Thu Oct 22 17:07:52 2015 +0200
+++ b/common/src/main/java/digilib/image/ImageJobDescription.java	Mon Oct 26 13:23:48 2015 +0100
@@ -404,7 +404,13 @@
             double scaleX = getDw() / areaWidth * ws;
             double scaleY = getDh() / areaHeight * ws;
             // use the smaller factor to get fit-in-box
-            scaleXY = (scaleX > scaleY) ? scaleY : scaleX;
+            if (scaleX == 0) {
+            	scaleXY = scaleY;
+            } else if (scaleY == 0) {
+            	scaleXY = scaleX;
+            } else {
+            	scaleXY = (scaleX > scaleY) ? scaleY : scaleX;
+            }
         } else if (isAbsoluteScale()) {
             /*
              * absolute scaling factor -- either original size, based on dpi, or absolute 
@@ -479,7 +485,7 @@
             paramDW = getAsInt("dw");
             paramDH = getAsInt("dh");
 
-            if (paramDW == 0) {
+            if (paramDW == 0 && input != null) {
                 /*
                  * calculate dw using aspect ratio of image area
                  */
@@ -488,7 +494,7 @@
                 // round up to make sure we don't squeeze dh
                 paramDW = (int) Math.ceil(paramDH * imgAspect);
                 setValue("dw", paramDW);
-            } else if (paramDH == 0) {
+            } else if (paramDH == 0 && input != null) {
                 /*
                  * calculate dh using aspect ratio of image area
                  */
@@ -516,7 +522,7 @@
             paramDW = getAsInt("dw");
             paramDH = getAsInt("dh");
 
-            if (paramDW == 0) {
+            if (paramDW == 0 && input != null) {
                 /*
                  * calculate dw using aspect ratio of image area
                  */
@@ -525,7 +531,7 @@
                 // round up to make sure we don't squeeze dh
                 paramDW = (int) Math.ceil(paramDH * imgAspect);
                 setValue("dw", paramDW);
-            } else if (paramDH == 0) {
+            } else if (paramDH == 0 && input != null) {
                 /*
                  * calculate dh using aspect ratio of image area
                  */