code: private void updateScaling() {
  
          List<I_CmsTransform> transforms = new ArrayList<>();
          CmsCroppingParamBean crop = m_croppingProvider.get();
          CmsImageInfoBean info = m_imageInfoProvider.get();
  
          double wv = m_image.getElement().getParentElement().getOffsetWidth();
          double hv = m_image.getElement().getParentElement().getOffsetHeight();
          if (crop == null) {
              transforms.add(
                  new CmsBoxFit(CmsBoxFit.Mode.scaleOnlyIfNecessary, wv, hv, info.getWidth(), info.getHeight()));
          } else {
              int wt, ht;
              wt = crop.getTargetWidth() >= 0 ? crop.getTargetWidth() : info.getWidth();
              ht = crop.getTargetHeight() >= 0 ? crop.getTargetHeight() : info.getHeight();
              transforms.add(new CmsBoxFit(CmsBoxFit.Mode.scaleOnlyIfNecessary, wv, hv, wt, ht));
              if (crop.isCropped()) {
                  transforms.add(
                      new CmsBoxFit(CmsBoxFit.Mode.scaleAlways, wt, ht, crop.getCropWidth(), crop.getCropHeight()));
                  transforms.add(new CmsTranslate(crop.getCropX(), crop.getCropY()));
              } else {
                  transforms.add(
                      new CmsBoxFit(CmsBoxFit.Mode.scaleAlways, wt, ht, crop.getOrgWidth(), crop.getOrgHeight()));
              }
          }
          CmsCompositeTransform chain = new CmsCompositeTransform(transforms);
          m_coordinateTransform = chain;
          if ((crop == null) || !crop.isCropped()) {
              m_region = transformRegionBack(
                  m_coordinateTransform,
                  CmsRectangle.fromLeftTopWidthHeight(0, 0, info.getWidth(), info.getHeight()));
          } else {
              m_region = transformRegionBack(
                  m_coordinateTransform,
                  CmsRectangle.fromLeftTopWidthHeight(
                      crop.getCropX(),
                      crop.getCropY(),
                      crop.getCropWidth(),
                      crop.getCropHeight()));
          }
      }
docs: Sets up the coordinate transformations between the coordinate system of the parent element of the image element and the native coordinate system
  of the original image.