public class ImageJAndJava2DImageService extends Java2DProgressiveBilinearImageService
AbstractJava2DImageService.OperationTypeAbstractImageService.ResizeCoordsJahiaImageService.ResizeType| Modifier and Type | Method and Description |
|---|---|
boolean |
createThumb(Image iw,
File outputFile,
int size,
boolean square)
Creates an image thumbnail and stores it in a specified file
|
boolean |
cropImage(Image image,
File outputFile,
int top,
int left,
int width,
int height)
Crops an image to a specified file using the specified coordinates
Note : due to a bug, the X and Y are reversed, be careful about that !
|
int |
getHeight(Image i)
Retrieves the height in pixels of the specified image
|
Image |
getImage(JCRNodeWrapper node)
Retrieve the image stored in a JCR node
|
static ImageJAndJava2DImageService |
getInstance() |
int |
getWidth(Image i)
Retrieves the width in pixels of the specified image
|
void |
init() |
BufferedImage |
resizeImage(BufferedImage image,
int width,
int height,
JahiaImageService.ResizeType resizeType)
Resize an image using different types of resize algorithms.
|
boolean |
resizeImage(Image image,
File outputFile,
int newWidth,
int newHeight,
JahiaImageService.ResizeType resizeType)
Resize an image using different types of resize algorithms.
|
boolean |
rotateImage(Image image,
File outputFile,
boolean clockwise)
Rotate an image clockwise or counter clockwise
|
getGraphics2DcanRead, getDestImage, rotateImage, saveImageToFilegetResizeCoords, resizeImagepublic void init()
public static ImageJAndJava2DImageService getInstance()
public Image getImage(JCRNodeWrapper node) throws IOException, javax.jcr.RepositoryException
JahiaImageServicegetImage in interface JahiaImageServicegetImage in class AbstractJava2DImageServicenode - the JCR node that contains the image data.IOExceptionjavax.jcr.RepositoryException - in case of JCR-related errorspublic boolean createThumb(Image iw, File outputFile, int size, boolean square) throws IOException
JahiaImageServicecreateThumb in interface JahiaImageServicecreateThumb in class AbstractImageServiceiw - the image for which to generate a thumbnail, this image is loaded through the
getImage methodoutputFile - the file in which to store the generated thumbnailsize - the size in pixels of the generated thumbnail. Usually this will mean the desired
width or height of the image, except if the square option is specified.square - if false, a ResizeType.ADJUST_SIZE resize will be performed, otherwise if
square is true, a ResizeType.ASPECT_FILL will be performed. For more information about these
resize types, see the resize method.IOExceptionpublic int getHeight(Image i)
JahiaImageServicegetHeight in interface JahiaImageServicegetHeight in class AbstractJava2DImageServicei - the image for which to retrieve the heightpublic int getWidth(Image i)
JahiaImageServicegetWidth in interface JahiaImageServicegetWidth in class AbstractJava2DImageServicei - the imagepublic boolean cropImage(Image image, File outputFile, int top, int left, int width, int height) throws IOException
JahiaImageServicecropImage in interface JahiaImageServicecropImage in class AbstractJava2DImageServiceimage - the image to cropoutputFile - the destination file in which to store the cropped image. The file type
of the original image is conservedtop - the top Y coordinate at which to start the cropleft - the left X coordinate at which to start the cropwidth - the width of the crop regionheight - the height of the crop region.IOExceptionpublic boolean rotateImage(Image image, File outputFile, boolean clockwise) throws IOException
JahiaImageServicerotateImage in interface JahiaImageServicerotateImage in class AbstractJava2DImageServiceimage - the image to rotateoutputFile - the file in which to store the rotated image, the original image type
is conservedclockwise - if the true, the image is rotated clockwise, otherwise it is rotated
counter clockwiseIOExceptionpublic boolean resizeImage(Image image, File outputFile, int newWidth, int newHeight, JahiaImageService.ResizeType resizeType) throws IOException
JahiaImageServiceresizeImage in interface JahiaImageServiceresizeImage in class Java2DProgressiveBilinearImageServiceimage - the image to resizeoutputFile - the file in which to output the resized imagenewWidth - the width of the resized imagenewHeight - the height of the resized imageresizeType - the type of resize algorithm to use. Uses a ResizeType enum also available
in this interfaceIOExceptionpublic BufferedImage resizeImage(BufferedImage image, int width, int height, JahiaImageService.ResizeType resizeType)
JahiaImageServiceresizeImage in interface JahiaImageServiceresizeImage in class Java2DProgressiveBilinearImageServiceimage - the image to resizewidth - the width of the resized imageheight - the height of the resized imageresizeType - the type of resize algorithm to use. Uses a JahiaImageService.ResizeType enum also available in this interfacenull in case of a failurefor details of the resizingCopyright © 2004–2020 Jahia Solutions Group SA. All rights reserved.