public interface JahiaImageService
| Modifier and Type | Interface and Description |
|---|---|
static class |
JahiaImageService.ResizeType
The resize type allows to control how the original image will be fitted
in the destination size
|
| 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 i,
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
|
int |
getWidth(Image i)
Retrieves the width in pixels of the specified image
|
BufferedImage |
resizeImage(BufferedImage image,
int width,
int height,
JahiaImageService.ResizeType resizeType)
Resize an image using different types of resize algorithms.
|
boolean |
resizeImage(Image i,
File outputFile,
int width,
int height)
Resize an image using an ADJUST_SIZE resize type.
|
boolean |
resizeImage(Image i,
File outputFile,
int width,
int height,
JahiaImageService.ResizeType resizeType)
Resize an image using different types of resize algorithms.
|
boolean |
rotateImage(Image i,
File outputFile,
boolean clockwise)
Rotate an image clockwise or counter clockwise
|
boolean |
rotateImage(Image i,
File outputFile,
double angle)
Rotate an image clockwise or counter clockwise
|
Image getImage(JCRNodeWrapper node) throws IOException, javax.jcr.RepositoryException
node - the JCR node that contains the image data.IOExceptionjavax.jcr.RepositoryException - in case of JCR-related errorsboolean createThumb(Image iw, File outputFile, int size, boolean square) throws IOException
iw - 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.IOExceptionint getHeight(Image i) throws IOException
i - the image for which to retrieve the heightIOExceptionint getWidth(Image i) throws IOException
i - the imageIOExceptionboolean cropImage(Image i, File outputFile, int top, int left, int width, int height) throws IOException
i - 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.IOExceptionboolean resizeImage(Image i, File outputFile, int width, int height) throws IOException
i - the image to resizeoutputFile - the output file where to output the resized imagewidth - the desired image widthheight - the desired image heightIOExceptionboolean rotateImage(Image i, File outputFile, boolean clockwise) throws IOException
i - 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 clockwiseIOExceptionboolean rotateImage(Image i, File outputFile, double angle) throws IOException
i - the image to rotateoutputFile - the file in which to store the rotated image, the original image type
is conservedangle - angle in degrees
counter clockwiseIOExceptionboolean resizeImage(Image i, File outputFile, int width, int height, JahiaImageService.ResizeType resizeType) throws IOException
i - the image to resizeoutputFile - the file in which to output the resized imagewidth - the width of the resized imageheight - the height of the resized imageresizeType - the type of resize algorithm to use. Uses a ResizeType enum also available
in this interfaceIOExceptionBufferedImage resizeImage(BufferedImage image, int width, int height, JahiaImageService.ResizeType resizeType) throws IOException
image - 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 failureIOExceptionfor details of the resizingCopyright © 2004–2020 Jahia Solutions Group SA. All rights reserved.