public class ImageMagickImageService extends AbstractImageService
AbstractImageService.ResizeCoordsJahiaImageService.ResizeType| Modifier | Constructor and Description |
|---|---|
protected |
ImageMagickImageService() |
| Modifier and Type | Method and Description |
|---|---|
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
|
static ImageMagickImageService |
getInstance() |
int |
getWidth(Image i)
Retrieves the width in pixels of the specified image
|
void |
init() |
protected void |
readDimensions(ImageMagickImage img) |
BufferedImage |
resizeImage(BufferedImage image,
int width,
int height,
JahiaImageService.ResizeType resizeType)
Resize an image using different types of resize algorithms.
|
protected boolean |
resizeImage(File inputFile,
File outputFile,
int width,
int height,
JahiaImageService.ResizeType resizeType) |
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 image,
File outputFile,
boolean clockwise)
Rotate an image clockwise or counter clockwise
|
boolean |
rotateImage(Image image,
File outputFile,
double angle)
Rotate an image clockwise or counter clockwise
|
void |
setImageMagickPath(String imageMagickPath) |
createThumb, getResizeCoords, resizeImagepublic void init()
public static ImageMagickImageService getInstance()
public void setImageMagickPath(String imageMagickPath)
public Image getImage(JCRNodeWrapper node) throws IOException, javax.jcr.RepositoryException
JahiaImageServicenode - the JCR node that contains the image data.IOExceptionjavax.jcr.RepositoryException - in case of JCR-related errorsprotected void readDimensions(ImageMagickImage img)
public int getHeight(Image i) throws IOException
JahiaImageServicei - the image for which to retrieve the heightIOExceptionpublic int getWidth(Image i) throws IOException
JahiaImageServicei - the imageIOExceptionpublic boolean cropImage(Image i, File outputFile, int top, int left, int width, int height) throws IOException
JahiaImageServicei - 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
JahiaImageServiceimage - 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 rotateImage(Image image, File outputFile, double angle) throws IOException
JahiaImageServiceimage - the image to rotateoutputFile - the file in which to store the rotated image, the original image type
is conservedangle - angle in degrees
counter clockwiseIOExceptionpublic boolean resizeImage(Image i, File outputFile, int width, int height, JahiaImageService.ResizeType resizeType) throws IOException
JahiaImageServicei - 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 interfaceIOExceptionpublic BufferedImage resizeImage(BufferedImage image, int width, int height, JahiaImageService.ResizeType resizeType) throws IOException
JahiaImageServiceimage - 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 resizingprotected boolean resizeImage(File inputFile, File outputFile, int width, int height, JahiaImageService.ResizeType resizeType) throws IOException
IOExceptionCopyright © 2004–2020 Jahia Solutions Group SA. All rights reserved.