# HG changeset patch # User robcast # Date 1445862228 -3600 # Node ID 849a06d55cc6060e4afc0b9454cffccfd168fa96 # Parent e6ad329cfac8cb1a3ad62f3e54a4591b8e3cde9b trying to fix bug when using prescaled images and only either dw or dh. (this is turning into a mess :-( ) diff -r e6ad329cfac8 -r 849a06d55cc6 common/src/main/java/digilib/image/ImageJobDescription.java --- 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 */