public class ImageEngine extends Object
Modifier and Type | Field and Description |
---|---|
static Color |
DETECT_COLOR
special color to set automatic color (value is random)
|
static Color |
NEUTRAL_COLOR |
static Color |
TRANSPARENT_COLOR |
Constructor and Description |
---|
ImageEngine() |
Modifier and Type | Method and Description |
---|---|
static BufferedImage |
_scale(BufferedImage img,
Integer inTargetWidth,
Integer inTargetHeight) |
static void |
addAlpha(BufferedImage img,
float inAlpha) |
static BufferedImage |
addPictureBorder(BufferedImage image,
Color backgroundColors)
add picture border (transform portrait (phone picture) to landscape).
|
static BufferedImage |
addTransparanceBorder(BufferedImage image,
Color backgroundColors,
int size,
int degradedSize,
int position) |
static BufferedImage |
applyBgColor(BufferedImage image,
Color bgColor) |
static BufferedImage |
applyFilter(BufferedImage source,
BufferedImage filter,
boolean cropResize,
boolean addBorder,
int mt,
int ml,
int mr,
int mb,
int fzx,
int fzy,
boolean isFocus,
Color bgColor,
boolean hq) |
static void |
applySepiaFilter(BufferedImage img,
int sepiaIntensity) |
static BufferedImage |
avg(BufferedImage original) |
static BufferedImage |
blurring(BufferedImage img) |
static BufferedImage |
borderCorner(BufferedImage image,
Color bg) |
static BufferedImage |
borderCorner(BufferedImage image,
int radius,
Color bg) |
static BufferedImage |
centerInterest(BufferedImage source,
int interestX,
int interestY,
int minWidth,
int minHeight) |
static double |
closeColor(BufferedImage image,
Color color)
search a color inside a image.
|
static Color |
combineColor(Color color1,
Color color2)
combine two color with transparency on first
|
static Color |
combineColor(Color c1,
Color c2,
float alpha)
combine two color with transparency
|
static void |
compressJpegFile(BufferedImage image,
OutputStream out,
double compressionQuality) |
static BufferedImage |
convertRGBAToIndexed(BufferedImage src) |
static BufferedImage |
createAlpha(BufferedImage image,
Color bg)
replace bg color with transparency
|
static BufferedImage |
cropImage(BufferedImage image,
int width,
int height,
int inX,
int inY) |
static BufferedImage |
dashed(BufferedImage image,
int size)
create transparent dash on 1 pixel on 2
|
static BufferedImage |
desaturation(BufferedImage original) |
static BufferedImage |
drawBorderCorner(BufferedImage image,
int radius,
Color bg,
int size) |
static boolean |
equalColor(Color c1,
Color c2,
int tolerance)
test if two color is the same with tolerance
|
static BufferedImage |
flip(BufferedImage image,
boolean verticaly) |
static int |
getColor(BufferedImage image,
int x,
int y)
get a color in a image, coord can be out of the image size.
|
static int |
getColor(BufferedImage image,
int x,
int y,
Color outCol) |
static int |
getColorDistance(Color c1,
Color c2)
the "mathematical" distance between two color.
|
static float |
getColorDistanceFactor(Color c1,
Color c2)
the "mathematical" distance between two color. 1 : balck and white, 0 : same
color
|
static Color |
getTextColorOnBackground(Color backgroundColor)
return white on dark background and black otherwise
|
static BufferedImage |
grayscale(BufferedImage inImage) |
static void |
insertImage(BufferedImage source,
BufferedImage target,
int posx,
int posy) |
static boolean |
isDark(BufferedImage image)
return true if picture is to close of black than white
|
static BufferedImage |
lightBlurring(BufferedImage img) |
static BufferedImage |
loadImage(File file) |
static BufferedImage |
luminosity(BufferedImage original) |
static void |
main(String[] args) |
static Color |
neverNullColor(Color color)
if color null return transparent.
|
static BufferedImage |
projectionImage(BufferedImage back,
BufferedImage top,
BufferedImage source,
Polygon4 p4,
float alpha) |
static BufferedImage |
RBGAdjust(BufferedImage image,
Color adjustColor) |
static BufferedImage |
removeAlpha(BufferedImage image) |
static BufferedImage |
replaceAlpha(BufferedImage image,
Color bg) |
static BufferedImage |
resize(BufferedImage bi,
Integer width,
Integer height,
boolean hq) |
static BufferedImage |
resize(BufferedImage source,
int inWidth,
int inHeight,
boolean cropResize,
boolean addBorder,
int mt,
int ml,
int mr,
int mb,
Color bgColor,
int interestX,
int interestY,
boolean focusZone,
boolean hq)
resize a picture
|
static BufferedImage |
resizeDashed(BufferedImage image,
int factor)
create transparent dash
|
static BufferedImage |
resizeHeight(BufferedImage bi,
int height,
Color bgColor,
boolean hq) |
static BufferedImage |
resizeImage(BufferedImage in,
int width,
int height) |
static BufferedImage |
resizeWidth(BufferedImage bi,
int width,
boolean hq) |
static BufferedImage |
resizeWidth(BufferedImage bi,
int width,
int mt,
int mr,
int ml,
int mb,
Color bgColor,
boolean hq) |
static BufferedImage |
rotate(BufferedImage image,
int angle,
Color bg)
rotate the image with angle in degree. note than result can be bigger than
source.
|
static BufferedImage |
scale(BufferedImage img,
Integer inTargetWidth,
Integer inTargetHeight,
boolean hq) |
static void |
storeImage(BufferedImage img,
File file) |
static BufferedImage |
trim(BufferedImage image,
Color color,
int tolerance) |
static BufferedImage |
trimBottom(BufferedImage image,
Color color,
int tolerance) |
static BufferedImage |
trimLeft(BufferedImage image,
Color color,
int tolerance) |
static BufferedImage |
trimRight(BufferedImage image,
Color color,
int tolerance) |
static BufferedImage |
trimTop(BufferedImage image,
Color color,
int tolerance) |
static BufferedImage |
ultraLight(BufferedImage image) |
static BufferedImage |
web2(BufferedImage image,
Color bgColor,
int height,
int separation) |
static BufferedImage |
zoom(BufferedImage img,
double zoom,
int interestX,
int interestY) |
public static final Color NEUTRAL_COLOR
public static final Color TRANSPARENT_COLOR
public static final Color DETECT_COLOR
public static BufferedImage loadImage(File file) throws IOException
IOException
public static void storeImage(BufferedImage img, File file) throws IOException
IOException
public static BufferedImage blurring(BufferedImage img)
public static BufferedImage luminosity(BufferedImage original)
public static BufferedImage avg(BufferedImage original)
public static BufferedImage desaturation(BufferedImage original)
public static BufferedImage lightBlurring(BufferedImage img)
public static BufferedImage resize(BufferedImage bi, Integer width, Integer height, boolean hq)
public static BufferedImage zoom(BufferedImage img, double zoom, int interestX, int interestY)
public static BufferedImage scale(BufferedImage img, Integer inTargetWidth, Integer inTargetHeight, boolean hq)
public static BufferedImage _scale(BufferedImage img, Integer inTargetWidth, Integer inTargetHeight)
public static int getColor(BufferedImage image, int x, int y)
image
- a standard java imagex
- if < 0 -> get 0 id > width -> get width-1y
- if < 0 -> get 0 id > length -> get length-1public static Color neverNullColor(Color color)
color
- public static int getColor(BufferedImage image, int x, int y, Color outCol)
public static BufferedImage resizeHeight(BufferedImage bi, int height, Color bgColor, boolean hq)
public static BufferedImage resizeWidth(BufferedImage bi, int width, boolean hq)
public static BufferedImage resizeWidth(BufferedImage bi, int width, int mt, int mr, int ml, int mb, Color bgColor, boolean hq)
public static BufferedImage drawBorderCorner(BufferedImage image, int radius, Color bg, int size)
public static BufferedImage borderCorner(BufferedImage image, int radius, Color bg)
public static BufferedImage RBGAdjust(BufferedImage image, Color adjustColor)
public static BufferedImage borderCorner(BufferedImage image, Color bg)
public static BufferedImage replaceAlpha(BufferedImage image, Color bg)
public static BufferedImage createAlpha(BufferedImage image, Color bg)
image
- bg
- public static BufferedImage removeAlpha(BufferedImage image)
public static BufferedImage applyFilter(BufferedImage source, BufferedImage filter, boolean cropResize, boolean addBorder, int mt, int ml, int mr, int mb, int fzx, int fzy, boolean isFocus, Color bgColor, boolean hq)
public static BufferedImage centerInterest(BufferedImage source, int interestX, int interestY, int minWidth, int minHeight)
public static BufferedImage resize(BufferedImage source, int inWidth, int inHeight, boolean cropResize, boolean addBorder, int mt, int ml, int mr, int mb, Color bgColor, int interestX, int interestY, boolean focusZone, boolean hq)
source
- the source imageinWidth
- new withinHeight
- new heightcropResize
- true if image must be croped or false if image must be deformedmt
- margin topml
- margin leftmr
- margin rightmb
- margin bottombgColor
- background color (for margin and alpha)interestX
- x position of the interest zone in the pictureinterestY
- y position of the interest zone in the picturepublic static void insertImage(BufferedImage source, BufferedImage target, int posx, int posy)
public static BufferedImage applyBgColor(BufferedImage image, Color bgColor)
public static BufferedImage resizeImage(BufferedImage in, int width, int height) throws IOException
IOException
public static BufferedImage web2(BufferedImage image, Color bgColor, int height, int separation)
public static BufferedImage cropImage(BufferedImage image, int width, int height, int inX, int inY)
public static void compressJpegFile(BufferedImage image, OutputStream out, double compressionQuality)
public static BufferedImage rotate(BufferedImage image, int angle, Color bg)
image
- angle
- public static BufferedImage dashed(BufferedImage image, int size)
image
- public static BufferedImage resizeDashed(BufferedImage image, int factor)
image
- public static BufferedImage grayscale(BufferedImage inImage)
public static int getColorDistance(Color c1, Color c2)
c1
- c2
- public static float getColorDistanceFactor(Color c1, Color c2)
c1
- c2
- public static Color getTextColorOnBackground(Color backgroundColor)
backgroundColor
- public static double closeColor(BufferedImage image, Color color)
image
- color
- public static void applySepiaFilter(BufferedImage img, int sepiaIntensity)
img
- Image to modifysepiaIntensity
- From 0-255, 30 produces nice resultsException
public static BufferedImage flip(BufferedImage image, boolean verticaly)
public static boolean equalColor(Color c1, Color c2, int tolerance)
c1
- c2
- tolerance
- difference between two colors 0 >> 3*255public static BufferedImage trimTop(BufferedImage image, Color color, int tolerance)
public static BufferedImage trimLeft(BufferedImage image, Color color, int tolerance)
public static BufferedImage trimBottom(BufferedImage image, Color color, int tolerance)
public static BufferedImage trimRight(BufferedImage image, Color color, int tolerance)
public static BufferedImage trim(BufferedImage image, Color color, int tolerance)
public static BufferedImage ultraLight(BufferedImage image)
public static Color combineColor(Color c1, Color c2, float alpha)
c1
- front colorc2
- back coloralpha
- transparency (0>1)public static Color combineColor(Color color1, Color color2)
c1
- front colorc2
- back colorpublic static void addAlpha(BufferedImage img, float inAlpha)
public static BufferedImage projectionImage(BufferedImage back, BufferedImage top, BufferedImage source, Polygon4 p4, float alpha) throws Exception
Exception
public static boolean isDark(BufferedImage image)
image
- public static BufferedImage addPictureBorder(BufferedImage image, Color backgroundColors)
image
- public static BufferedImage addTransparanceBorder(BufferedImage image, Color backgroundColors, int size, int degradedSize, int position)
image
- backgroundColors
- size
- size of border (in %)degradedSize
- degraded size bewteen background and imageposition
- 1:top 2: right 3:bottom 4:leftpublic static BufferedImage convertRGBAToIndexed(BufferedImage src)
Copyright © 2012-2018. All Rights Reserved.