Package codes.thischwa.jii.core
Class ImageMagickWrapper
- java.lang.Object
-
- codes.thischwa.jii.core.ImageMagickWrapper
-
- All Implemented Interfaces:
IDimensionProvider
,IInfoProvider
,IResolutionProvider
public class ImageMagickWrapper extends Object implements IDimensionProvider, IResolutionProvider
Wrapper to the operation bean to the command 'identify' of ImageMagick.Hint: On same OSs the path to the library of ImageMagick must be specified. A corresponding constructor is provided.
- Author:
- Thilo Schwarz
-
-
Constructor Summary
Constructors Constructor Description ImageMagickWrapper(String cmd)
Initializes the wrapper.ImageMagickWrapper(String cmd, String libPath)
Initializes the wrapper.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Dimension
getDimension()
Obtain theDimension
of the current image.ImageType
getImageType()
Obtain theImageType
of the current image file.Resolution
getResolution()
Obtain theResolution
of the current image.ImageType[]
getSupportedTypes()
Return allImageType
s supported by the implemented class.void
set(File file)
Specify the imageFile
to be examine.void
set(InputStream in)
Specify theInputStream
of image file to be examine.
-
-
-
Constructor Detail
-
ImageMagickWrapper
public ImageMagickWrapper(String cmd)
Initializes the wrapper.- Parameters:
cmd
- full path to the command 'identify'
-
-
Method Detail
-
getSupportedTypes
public ImageType[] getSupportedTypes()
Description copied from interface:IInfoProvider
Return allImageType
s supported by the implemented class.- Specified by:
getSupportedTypes
in interfaceIInfoProvider
- Returns:
- A set of
ImageType
s.
-
getImageType
public ImageType getImageType()
Description copied from interface:IInfoProvider
Obtain theImageType
of the current image file.- Specified by:
getImageType
in interfaceIInfoProvider
- Returns:
- The
ImageType
of the current image file.
-
set
public void set(File file) throws FileNotFoundException, ReadException
Description copied from interface:IInfoProvider
Specify the imageFile
to be examine.- Specified by:
set
in interfaceIInfoProvider
- Parameters:
file
- The imageFile
to be examine.- Throws:
FileNotFoundException
- If the file to be examine couldn't find.ReadException
- If the required reading operation fails.
-
set
public void set(InputStream in) throws ReadException, UnsupportedOperationException
Description copied from interface:IInfoProvider
Specify theInputStream
of image file to be examine.- Specified by:
set
in interfaceIInfoProvider
- Parameters:
in
- TheInputStream
of the image file to be examine.- Throws:
ReadException
- If the required reading operation fails.UnsupportedOperationException
- If the implemented class doesn't provide support forInputStream
s.
-
getDimension
public Dimension getDimension() throws ReadException
Description copied from interface:IDimensionProvider
Obtain theDimension
of the current image.- Specified by:
getDimension
in interfaceIDimensionProvider
- Returns:
- The
Dimension
of the current image. - Throws:
ReadException
- If the required operations to determine the dimension fail.
-
getResolution
public Resolution getResolution() throws ReadException
Description copied from interface:IResolutionProvider
Obtain theResolution
of the current image.- Specified by:
getResolution
in interfaceIResolutionProvider
- Returns:
- The
Resolution
of the current image. - Throws:
ReadException
- If the required operations to determine the resolution fail.
-
-