Class ImageUtils
java.lang.Object
com.vladsch.flexmark.util.misc.ImageUtils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BufferedImageaddBorder(BufferedImage image, Color borderColor, int borderWidth, int cornerRadius) static BufferedImagebase64Decode(File file) static BufferedImagebase64Decode(String encoded) static Stringbase64Encode(BufferedImage image) static Stringbase64Encode(File file) static BufferedImagecropImage(BufferedImage image, int trimLeft, int trimRight, int trimTop, int trimBottom) static BufferedImagedrawHighlightOval(BufferedImage image, int x, int y, int w, int h, Color borderColor, int borderWidth, Color innerFillColor) static BufferedImagedrawHighlightRectangle(BufferedImage image, int x, int y, int w, int h, Color borderColor, int borderWidth, int cornerRadius, Color innerFillColor) static BufferedImagedrawOval(BufferedImage image, int x, int y, int w, int h, Color borderColor, int borderWidth, float[] dash, float dashPhase) static BufferedImagedrawRectangle(BufferedImage image, int x, int y, int w, int h, Color borderColor, int borderWidth, int cornerRadius) static BufferedImagedrawRectangle(BufferedImage image, int x, int y, int w, int h, Color borderColor, int borderWidth, int cornerRadius, float[] dash, float dashPhase) static byte[]getImageBytes(BufferedImage image) static Imagestatic ImagegetImageFromTransferable(Transferable transferable) static booleanisEncodedImage(String encoded) static booleanisPossiblyEncodedImage(String encoded) static BufferedImageloadImageFromContent(byte[] cachedImageBytes, String idPath) static BufferedImageloadImageFromFile(File cachedImageFile) static BufferedImageloadImageFromURL(String imageURL) static BufferedImageloadImageFromURL(String imageURL, boolean logImageProcessing) Load image from URL.static BufferedImagemakeRoundedCorner(BufferedImage image, int cornerRadius, int borderWidth) static BufferedImagepunchOuterHighlightOval(BufferedImage image, BufferedImage outerImage, int x, int y, int w, int h, int borderWidth, Color outerFillColor, int outerBorderWidth, int outerCornerRadius, boolean applyToImage) static BufferedImagepunchOuterHighlightRectangle(BufferedImage image, BufferedImage outerImage, int x, int y, int w, int h, int borderWidth, int cornerRadius, Color outerFillColor, int outerBorderWidth, int outerCornerRadius, boolean applyToImage) static BufferedImageremoveAlpha(BufferedImage image) static voidsave(BufferedImage image, File file, String format) static BufferedImagescaleImage(BufferedImage sourceImage, int newWidth, int newHeight, int opType) static BufferedImagetoBufferedImage(Image src) static ImagetoTransparent(BufferedImage image, Color color, int tolerance)
-
Field Details
-
TRANSPARENT
-
BASE64_ENCODING_PATTERN
-
-
Constructor Details
-
ImageUtils
public ImageUtils()
-
-
Method Details
-
getImageFromClipboard
-
getImageFromTransferable
-
scaleImage
public static BufferedImage scaleImage(BufferedImage sourceImage, int newWidth, int newHeight, int opType) -
toBufferedImage
-
save
-
loadImageFromFile
- Parameters:
cachedImageFile- file- Returns:
- Could be
nullif the image could not be read from the file (because of whatever strange reason).
-
loadImageFromContent
- Parameters:
cachedImageBytes- fileidPath- image file path for error reporting- Returns:
- Could be
nullif the image could not be read from the file (because of whatever strange reason).
-
base64Encode
-
base64Encode
-
base64Decode
-
isEncodedImage
-
isPossiblyEncodedImage
-
base64Decode
-
loadImageFromURL
-
loadImageFromURL
Load image from URL.NOTE: Java7 JDK cannot load some images including GitHub emoji. Compiling this library with Java8 solves the problem.
- Parameters:
imageURL- url of the imagelogImageProcessing- true if errors are to print to console- Returns:
- image or null if failed to download.
-
makeRoundedCorner
public static BufferedImage makeRoundedCorner(BufferedImage image, int cornerRadius, int borderWidth) -
addBorder
public static BufferedImage addBorder(BufferedImage image, Color borderColor, int borderWidth, int cornerRadius) -
drawRectangle
public static BufferedImage drawRectangle(BufferedImage image, int x, int y, int w, int h, Color borderColor, int borderWidth, int cornerRadius) -
drawRectangle
public static BufferedImage drawRectangle(BufferedImage image, int x, int y, int w, int h, Color borderColor, int borderWidth, int cornerRadius, float[] dash, float dashPhase) -
drawOval
public static BufferedImage drawOval(BufferedImage image, int x, int y, int w, int h, Color borderColor, int borderWidth, float[] dash, float dashPhase) -
drawHighlightRectangle
public static BufferedImage drawHighlightRectangle(BufferedImage image, int x, int y, int w, int h, Color borderColor, int borderWidth, int cornerRadius, Color innerFillColor) -
drawHighlightOval
public static BufferedImage drawHighlightOval(BufferedImage image, int x, int y, int w, int h, Color borderColor, int borderWidth, Color innerFillColor) -
punchOuterHighlightRectangle
public static BufferedImage punchOuterHighlightRectangle(BufferedImage image, BufferedImage outerImage, int x, int y, int w, int h, int borderWidth, int cornerRadius, Color outerFillColor, int outerBorderWidth, int outerCornerRadius, boolean applyToImage) -
punchOuterHighlightOval
public static BufferedImage punchOuterHighlightOval(BufferedImage image, BufferedImage outerImage, int x, int y, int w, int h, int borderWidth, Color outerFillColor, int outerBorderWidth, int outerCornerRadius, boolean applyToImage) -
cropImage
public static BufferedImage cropImage(BufferedImage image, int trimLeft, int trimRight, int trimTop, int trimBottom) -
removeAlpha
-
toTransparent
-
getImageBytes
-