Package org.javlo.image
Class ImageHelper
- java.lang.Object
-
- org.javlo.image.ImageHelper
-
public class ImageHelper extends Object
- Author:
- pvanderm
-
-
Field Summary
Fields Modifier and Type Field Description static int
BACK_AND_WHITE_FILTER
protected static Logger
logger
create a static logger.static int
NO_FILTER
-
Constructor Summary
Constructors Constructor Description ImageHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BufferedImage
createAbsoluteLittleImage(javax.servlet.ServletContext servletContext, String name, int width)
static void
createImage(File file, int fx, int fy)
static BufferedImage
createLittleImage(javax.servlet.ServletContext servletContext, String name, int width)
static String
createSpecialDirectory(int width)
static String
createSpecialDirectory(int width, int filter)
static String
createSpecialDirectory(ContentContextBean ctxb, String context, String filter, String area, String deviceCode, Template template, IImageFilter comp, ImageConfig.ImageParameters param)
static BufferedImage
getBestImageFromVideo(File file)
static int
getColorCount(BufferedImage image)
static double
getContrastRatio(BufferedImage image)
static Map<String,String>
getExifData(InputStream in)
static ImageSize
getExifSize(InputStream in)
return dimension of picture in exif data, null if not found.static String
getImageExtensionToManType(String ext)
static String
getImageFormat(String fileName)
static ImageSize
getImageSize(File file)
static ImageSize
getJpegSize(InputStream in)
static BufferedImage
loadImage(javax.servlet.ServletContext servletContext, String name)
static void
main(String[] args)
static String
pathToKey(String path)
transform a path in a string to a key. this key can be a directory name ( sp.static BufferedImage
resize(BufferedImage aOrgImage, int width)
static void
saveImage(BufferedImage image, File file)
static BufferedImage
toBufferedImage(org.jcodec.common.model.Picture src)
static void
toBufferedImage(org.jcodec.common.model.Picture src, BufferedImage dst)
-
-
-
Field Detail
-
logger
protected static Logger logger
create a static logger.
-
NO_FILTER
public static final int NO_FILTER
- See Also:
- Constant Field Values
-
BACK_AND_WHITE_FILTER
public static final int BACK_AND_WHITE_FILTER
- See Also:
- Constant Field Values
-
-
Method Detail
-
createSpecialDirectory
public static String createSpecialDirectory(int width)
-
createSpecialDirectory
public static String createSpecialDirectory(ContentContextBean ctxb, String context, String filter, String area, String deviceCode, Template template, IImageFilter comp, ImageConfig.ImageParameters param)
-
createSpecialDirectory
public static String createSpecialDirectory(int width, int filter)
-
pathToKey
public static String pathToKey(String path)
transform a path in a string to a key. this key can be a directory name ( sp. replace / and \ with _ ).- Parameters:
path
- a path to a file- Returns:
- a key can be a directory name.
-
createAbsoluteLittleImage
public static BufferedImage createAbsoluteLittleImage(javax.servlet.ServletContext servletContext, String name, int width) throws IOException
- Throws:
IOException
-
loadImage
public static BufferedImage loadImage(javax.servlet.ServletContext servletContext, String name) throws IOException
- Throws:
IOException
-
createLittleImage
public static BufferedImage createLittleImage(javax.servlet.ServletContext servletContext, String name, int width) throws IOException
- Throws:
IOException
-
resize
public static BufferedImage resize(BufferedImage aOrgImage, int width)
-
getExifSize
public static ImageSize getExifSize(InputStream in) throws IOException
return dimension of picture in exif data, null if not found.- Parameters:
in
-- Returns:
- Throws:
IOException
-
getJpegSize
public static ImageSize getJpegSize(InputStream in)
-
getImageSize
public static ImageSize getImageSize(File file) throws IOException
- Throws:
IOException
-
getExifData
public static Map<String,String> getExifData(InputStream in) throws IOException
- Throws:
IOException
-
createImage
public static void createImage(File file, int fx, int fy) throws IOException
- Throws:
IOException
-
toBufferedImage
public static BufferedImage toBufferedImage(org.jcodec.common.model.Picture src)
-
toBufferedImage
public static void toBufferedImage(org.jcodec.common.model.Picture src, BufferedImage dst)
-
getContrastRatio
public static double getContrastRatio(BufferedImage image)
-
saveImage
public static void saveImage(BufferedImage image, File file) throws IOException
- Throws:
IOException
-
getColorCount
public static int getColorCount(BufferedImage image)
-
getBestImageFromVideo
public static BufferedImage getBestImageFromVideo(File file) throws IOException, org.jcodec.api.JCodecException
- Throws:
IOException
org.jcodec.api.JCodecException
-
-