Interface ImageProcessor
-
- All Superinterfaces:
Application.Component,Application.Module
- All Known Implementing Classes:
IIOImageProcessor,JaiImageProcessor
public interface ImageProcessor extends Application.Module
Handle image processing for VIVO; uploads and thumbnailing.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classImageProcessor.CropRectangleHolds the coordinates that we use to crop an image.static classImageProcessor.DimensionsThe size of a rectangular image, in pixels.static classImageProcessor.ImageProcessorExceptionA problem with the image.-
Nested classes/interfaces inherited from interface edu.cornell.mannlib.vitro.webapp.modules.Application.Component
Application.Component.LifecycleState
-
-
Field Summary
Fields Modifier and Type Field Description static intMINIMUM_CROP_SIZEWe won't let you crop to smaller than this many pixels wide or high.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description InputStreamcropAndScale(InputStream image, ImageProcessor.CropRectangle crop, ImageProcessor.Dimensions limits)Create a new image from a portion of the supplied image, and reduce to fit a limiting size.ImageProcessor.DimensionsgetDimensions(InputStream image)How big is the image contained in this stream?-
Methods inherited from interface edu.cornell.mannlib.vitro.webapp.modules.Application.Component
shutdown, startup
-
-
-
-
Field Detail
-
MINIMUM_CROP_SIZE
static final int MINIMUM_CROP_SIZE
We won't let you crop to smaller than this many pixels wide or high.- See Also:
- Constant Field Values
-
-
Method Detail
-
getDimensions
ImageProcessor.Dimensions getDimensions(InputStream image) throws ImageProcessor.ImageProcessorException, IOException
How big is the image contained in this stream?- Parameters:
image- The image stream. This method will not close it.- Returns:
- The dimensions of the image. Never returns null.
- Throws:
ImageProcessor.ImageProcessorException- if the stream does not contain a valid image.IOException- if the stream cannot be read.
-
cropAndScale
InputStream cropAndScale(InputStream image, ImageProcessor.CropRectangle crop, ImageProcessor.Dimensions limits) throws ImageProcessor.ImageProcessorException, IOException
Create a new image from a portion of the supplied image, and reduce to fit a limiting size. If the crop rectangle extends beyond the image boundaries, it is limited to fit, or relocated if limiting would make it smaller than the MINIMUM_CROP_SIZE.- Parameters:
image- The image stream. This method will not close it.crop- x and y determine the upper left corner of the crop area. height and width determine the size of the crop area.limits- The resulting image will be reduced as necessary to fit within these dimensions.- Returns:
- The new image. Client code should close this stream after reading. Never returns null.
- Throws:
ImageProcessor.ImageProcessorException- If the image is smaller than the minimum crop size, or if there is another problem cropping the image.IOException- if the image stream cannot be read.
-
-