info.magnolia.imaging.operations.cropresize
Class AutoCropAndResize
java.lang.Object
info.magnolia.imaging.operations.cropresize.AbstractCropAndResize
info.magnolia.imaging.operations.cropresize.AutoCropAndResize
- All Implemented Interfaces:
- ImageOperation
public class AutoCropAndResize
- extends AbstractCropAndResize
A CropAndResize implementation which will resize to the configured targetWidth and targetHeight,
and crop if needed: while respecting the ratio of the target dimensions, it will crop the image
such that the largest possible portion of the image is kept. It will keep the central part of the
image and cut off the external parts. (i.e centered crop)
If either targetWidth or targetHeight is <=0, the ratio of the source image will be preserved.
If both targetWidth and targetHeight are >0, both will be used, even if they don't match the ratio of the source image (thus cropping it).
- Version:
- $Id$
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AutoCropAndResize
public AutoCropAndResize()
getCroopCoords
protected Coords getCroopCoords(BufferedImage source,
ParameterProvider params)
throws ImagingException
- Description copied from class:
AbstractCropAndResize
- Determines the coordinates of the cropping to apply on the source image.
If no cropping needs to happen, return new Coords(0, 0, source.getWidth(), source.getHeight()).
- Specified by:
getCroopCoords
in class AbstractCropAndResize
- Throws:
ImagingException
getEffectiveTargetSize
protected Size getEffectiveTargetSize(BufferedImage source,
Coords cropCoords,
ParameterProvider params)
- Description copied from class:
AbstractCropAndResize
- Determines the actual size for the resized image based on the source image, the crop coordinates
calculated by
AbstractCropAndResize.getCroopCoords(java.awt.image.BufferedImage, P)
and the given ParameterProvider.
- Specified by:
getEffectiveTargetSize
in class AbstractCropAndResize
getTargetWidth
public int getTargetWidth()
setTargetWidth
public void setTargetWidth(int targetWidth)
getTargetHeight
public int getTargetHeight()
setTargetHeight
public void setTargetHeight(int targetHeight)
Copyright © 2013 Magnolia International Ltd.. All Rights Reserved.