code: public CmsCroppingParamBean getRestrictedSizeParam(int maxHeight, int maxWidth) {
  
          CmsCroppingParamBean result = new CmsCroppingParamBean(this);
          if ((getTargetHeight() <= maxHeight) && (getTargetWidth() <= maxWidth)) {
              if ((getTargetHeight() == I_CmsFormatRestriction.DIMENSION_NOT_SET) && (getOrgHeight() > maxHeight)) {
                  result.setTargetHeight(maxHeight);
              }
              if ((getTargetWidth() == I_CmsFormatRestriction.DIMENSION_NOT_SET) && (getOrgWidth() > maxWidth)) {
                  result.setTargetWidth(maxWidth);
              }
              return result;
          }
  
          if (((1.00 * getTargetHeight()) / getTargetWidth()) > ((1.00 * maxHeight) / maxWidth)) {
              result.setTargetHeight(maxHeight);
              double width = (1.00 * getTargetWidth() * maxHeight) / getTargetHeight();
              result.setTargetWidth((int)Math.floor(width));
              return result;
          }
          double height = (1.00 * getTargetHeight() * maxWidth) / getTargetWidth();
          result.setTargetHeight((int)Math.floor(height));
          result.setTargetWidth(maxWidth);
          return result;
      }
docs: Returns a cropping bean with a restricted maximum target size.<p>
  
  @param maxHeight the max height
  @param maxWidth the max width
  
  @return the cropping bean