Package com.simplicite.util.tools
Class ImageTool
- java.lang.Object
-
- com.simplicite.util.tools.ImageTool
-
public class ImageTool extends java.lang.Object
Image toolbox
This class only provides static variables and methods
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.io.File
resizeImage(java.io.File imagePath, int maxsize, java.lang.String format, java.lang.String outDir)
Resize an image: The generated file's name: resized_[name]_[maxsize].[format]static byte[]
resizeToJPG(byte[] orig, int width)
static byte[]
resizeToPNG(byte[] orig, int width)
static byte[]
text2image(java.lang.String text, java.lang.String fontName, int fontSize, int width, int height, int posX, int posY, java.lang.String format)
static byte[]
text2jpg(java.lang.String text, int textSize, int width, int height, int posX, int posY)
static byte[]
text2png(java.lang.String text, int textSize, int width, int height, int posX, int posY)
-
-
-
Method Detail
-
resizeImage
public static java.io.File resizeImage(java.io.File imagePath, int maxsize, java.lang.String format, java.lang.String outDir)
Resize an image: The generated file's name: resized_[name]_[maxsize].[format]
- Parameters:
imagePath
- Source imagemaxsize
- Output width/height size (fit/scale the image)format
- Output image format "JPG" "PNG"...outDir
- Output directory to save the file- Returns:
- The resized file or null if error
-
resizeToPNG
public static byte[] resizeToPNG(byte[] orig, int width) throws java.lang.Exception
- Throws:
java.lang.Exception
-
resizeToJPG
public static byte[] resizeToJPG(byte[] orig, int width) throws java.lang.Exception
- Throws:
java.lang.Exception
-
text2image
public static byte[] text2image(java.lang.String text, java.lang.String fontName, int fontSize, int width, int height, int posX, int posY, java.lang.String format)
-
text2png
public static byte[] text2png(java.lang.String text, int textSize, int width, int height, int posX, int posY)
-
text2jpg
public static byte[] text2jpg(java.lang.String text, int textSize, int width, int height, int posX, int posY)
-
-