code: private ImageProcessor zoom(ImageProcessor ip, String zoomAmt) {
          if (zoomAmt != null) {
              try {
                  float zoom = Float.parseFloat(zoomAmt);
  
                  if (zoom < 0) {
                      return ip;
                  }
  
                  ip.scale(zoom, zoom);
  
                  // if the image is being zoomed out, trim the extra whitespace around the image
                  if (zoom < 1) {
                      int imgWidth = ip.getWidth();
                      int imgHeight = ip.getHeight();
  
                      // set a ROI around the image, minus the extra whitespace
                      ip.setRoi(Math.round(imgWidth / 2 - imgWidth * zoom / 2),
                                Math.round(imgHeight / 2 - imgHeight * zoom / 2),
                                Math.round(imgWidth * zoom),
                                Math.round(imgHeight * zoom));
                      ip = ip.crop();
                  }
  
              }
  
              // no need to do anything with number format exception since the servlet
              // returns only images; just return the original image
              catch (NumberFormatException e) {
              }
          }
  
          return ip;
      }
docs: Zooms either in or out of an image by a supplied amount. The zooming
  occurs from the center of the image.
  
  @param ip
  The image to zoom zoomAmt The amount to zoom the image. 0 <
  zoomAmt < 1 : zoom out 1 = zoomAmt : original image 1 < zoomAmt :
  zoom in
  @return The image zoomed