changeset 1409:5f3265ea088c new_scaling

working on black-last-pixel bug...
author robcast
date Tue, 20 Oct 2015 15:11:19 +0200
parents 07914dfe7a4c
children 9fc1a281575f
files common/src/main/java/digilib/image/ImageJobDescription.java common/src/main/java/digilib/image/ImageLoaderDocuImage.java
diffstat 2 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/common/src/main/java/digilib/image/ImageJobDescription.java	Mon Oct 19 20:21:10 2015 +0200
+++ b/common/src/main/java/digilib/image/ImageJobDescription.java	Tue Oct 20 15:11:19 2015 +0200
@@ -480,14 +480,14 @@
             paramDH = getAsInt("dh");
 
             if (paramDW == 0) {
-                // calculate dw
+                // calculate dw using aspect ratio of image area
                 userImgArea = getUserImgArea();
                 double imgAspect = userImgArea.getWidth() / userImgArea.getHeight();
                 // 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
+                // calculate dh using aspect ratio of image area
             	userImgArea = getUserImgArea();
                 double imgAspect = userImgArea.getWidth() / userImgArea.getHeight();
                 // round up to make sure we don't squeeze dw
@@ -513,15 +513,17 @@
             paramDH = getAsInt("dh");
 
             if (paramDW == 0) {
-                // calculate dw
+                // calculate dw using aspect ratio of image area
                 userImgArea = getUserImgArea();
                 double imgAspect = userImgArea.getWidth() / userImgArea.getHeight();
+                // 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
+                // calculate dh using aspect ratio of image area
                 userImgArea = getUserImgArea();
                 double imgAspect = userImgArea.getWidth() / userImgArea.getHeight();
+                // round up to make sure we don't squeeze dh
                 paramDH = (int) Math.ceil(paramDW / imgAspect);
                 setValue("dh", paramDH);
             }
--- a/common/src/main/java/digilib/image/ImageLoaderDocuImage.java	Mon Oct 19 20:21:10 2015 +0200
+++ b/common/src/main/java/digilib/image/ImageLoaderDocuImage.java	Tue Oct 20 15:11:19 2015 +0200
@@ -448,6 +448,7 @@
 
     public void scale(double scaleX, double scaleY) throws ImageOpException {
         logger.debug("scale: " + scaleX);
+        logger.debug("scaled from " + img.getWidth() + "x" + img.getHeight() + " img=" + img);
         /* for downscaling in high quality the image is blurred first */
         if ((scaleX <= 0.5) && (quality > 1)) {
             int bl = (int) Math.floor(1 / scaleX);