类 UImages
java.lang.Object
com.gdxsoft.easyweb.utils.UImages
The image utils
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static BufferedImageappendLogo(BufferedImage originalImage, BufferedImage logo, int logoMaxWidth, int logoMaxHeight) Add a logo in the middle of a imagestatic booleanCheck whether using ImageMagick to resize imagestatic BufferedImagecreateBackground(BufferedImage srcImage, int radius, int border, int padding) Create a background imagestatic BufferedImagecreateClipCopy(Image originalImage, int left, int top, int right, int bottom) Crop the imagestatic File[]createResized(String imgPath, Dimension[] thumbnilsSize) Create the image thumbnailsstatic File[]createResized(String imgPath, Dimension[] thumbnilsSize, String outputExt, int quality) Create the image thumbnailsstatic File[]createResizedByImageMagick(String imgPath, Dimension[] thumbnilsSize) Create the image thumbnails (Using the ImageMagick)static File[]createResizedByImageMagick(String imgPath, Dimension[] thumbnilsSize, String outputExt, int quality) Create the image thumbnails (Using the ImageMagick)static File[]createResizedByJava(String imgPath, Dimension[] thumbnilsSize) Create the image thumbnail (Using java)static File[]createResizedByThumbnails(String imgPath, Dimension[] thumbnilsSize) Create the image thumbnails (using net.coobird.thumbnailator.Thumbnails)static File[]createResizedByThumbnails(String imgPath, Dimension[] thumbnilsSize, String outputExt, int quality) Create the image thumbnails (using net.coobird.thumbnailator.Thumbnails)static BufferedImagecreateResizedCopy(Image originalImage, int width, int height) Create an image according to the new sizestatic StringcreateSmallImage(String imgPath, int maxWidth, int maxHeight) Create the image thumbnailstatic StringcreateSmallImage(String imgPath, int maxWidth, int maxHeight, String outputExt, int quality) Create the image thumbnailstatic BufferedImagegetBufferedImage(String imgPath) Get a BufferedImage from the image path and namestatic byte[]getBytes(BufferedImage bi, String imageType, float quality) Convert to BufferedImge to file bufferstatic StringGet the imageMagick's magick pathstatic int[]getNewSize(BufferedImage bufferedImage, int maxWidth, int maxHeight) Get the image new size according the maximum width and maximum height limitsstatic StringgetResizedImageName(int width, int height, String outputExt) static StringgetResizedImageName(Dimension size, String outputExt) static voidimageSave(BufferedImage buf, File f1) Save the BufferedImage to file (JPEG, 0.8)static voidimageSave(BufferedImage buf, String name) Save the BufferedImage to file (JPEG, 0.8)static BufferedImagesetClip(BufferedImage srcImage, int radius) Set image radiusstatic BufferedImagesetRadius(BufferedImage srcImage, int radius, int border, int padding) Set the rounded corners of the imagestatic BufferedImagetoBufferedImage(Image image) Convert the Image to BufferedImage
-
字段详细资料
-
DEFAULT_QUALITY
public static int DEFAULT_QUALITYDefault image quality
-
-
构造器详细资料
-
UImages
public UImages()
-
-
方法详细资料
-
appendLogo
public static BufferedImage appendLogo(BufferedImage originalImage, BufferedImage logo, int logoMaxWidth, int logoMaxHeight) throws IOException Add a logo in the middle of a image- 参数:
originalImage- The original imagelogo- The logo imagelogoMaxWidth- The logo max widthlogoMaxHeight- The logo max height- 返回:
- the image with the logo
- 抛出:
IOException
-
setRadius
public static BufferedImage setRadius(BufferedImage srcImage, int radius, int border, int padding) throws IOException Set the rounded corners of the image- 参数:
srcImage- The source imageradius- The radius sizeborder- The border widthpadding- The padding size- 返回:
- The result
- 抛出:
IOException
-
createBackground
public static BufferedImage createBackground(BufferedImage srcImage, int radius, int border, int padding) Create a background image- 参数:
srcImage- The source imageradius- The radius sizeborder- The border widthpadding- The padding size- 返回:
- The result
-
setClip
Set image radius- 参数:
srcImage- The source imageradius- The radius size- 返回:
- the result
-
createSmallImage
Create the image thumbnail- 参数:
imgPath- The image path and namemaxwidth- The maximum widthmaxheight- The maximum height- 返回:
- The thumbnail image path and name
-
createSmallImage
public static String createSmallImage(String imgPath, int maxWidth, int maxHeight, String outputExt, int quality) Create the image thumbnail- 参数:
imgPath- The image path and namemaxWidth- The maximum widthmaxHeight- The maximum heightoutputExt- The output image extension, e.g. jpg or png or webp ...quality- The image quality- 返回:
- The thumbnail image path and name
-
createResizedByJava
public static File[] createResizedByJava(String imgPath, Dimension[] thumbnilsSize) throws Exception Create the image thumbnail (Using java)- 参数:
imgPath- The image path and namethumbnilsSize- The thumbnail sizes (800x600, 400x300)...- 返回:
- The thumbnail files array
- 抛出:
Exception
-
getNewSize
Get the image new size according the maximum width and maximum height limits- 参数:
bufferedImage- The imagemaxWidth- Maximum widthmaxHeight- Maximum height- 返回:
- size (width , height)
-
createResized
Create the image thumbnails- 参数:
imgPath- The image path and namethumbnilsSize- The thumbnails size(800x600, 400x300)...- 返回:
- The thumbnail files array
- 抛出:
Exception
-
createResized
public static File[] createResized(String imgPath, Dimension[] thumbnilsSize, String outputExt, int quality) throws Exception Create the image thumbnails- 参数:
imgPath- The image path and namethumbnilsSize- The thumbnails size(800x600, 400x300)...outputExt- output image ext, e.g. jpg or pngquality- The image quality- 返回:
- The thumbnail files array
- 抛出:
Exception
-
checkImageMagick
public static boolean checkImageMagick()Check whether using ImageMagick to resize image- 返回:
-
getImageMagick
Get the imageMagick's magick path- 返回:
- 抛出:
Exception
-
createResizedByImageMagick
public static File[] createResizedByImageMagick(String imgPath, Dimension[] thumbnilsSize) throws Exception Create the image thumbnails (Using the ImageMagick)- 参数:
imgPath- the image path and namethumbnilsSize- The thumbnails size(800x600, 400x300)...- 返回:
- The thumbnail files array
- 抛出:
Exception
-
getResizedImageName
-
getResizedImageName
-
createResizedByImageMagick
public static File[] createResizedByImageMagick(String imgPath, Dimension[] thumbnilsSize, String outputExt, int quality) throws Exception Create the image thumbnails (Using the ImageMagick)- 参数:
imgPath- the image path and namethumbnilsSize- The thumbnails size(800x600, 400x300)...outputExt- jpg or png or webp or heic ...quality- jpg quality- 返回:
- The thumbnail files array
- 抛出:
Exception
-
createResizedByThumbnails
Create the image thumbnails (using net.coobird.thumbnailator.Thumbnails)- 参数:
imgPath- the image path and namethumbnilsSize- The thumbnails size(800x600, 400x300)...- 返回:
- The thumbnail files array
- 抛出:
Exception
-
createResizedByThumbnails
public static File[] createResizedByThumbnails(String imgPath, Dimension[] thumbnilsSize, String outputExt, int quality) Create the image thumbnails (using net.coobird.thumbnailator.Thumbnails)- 参数:
imgPath- the image path and namethumbnilsSize- The thumbnails size(800x600, 400x300)...outputExt- output image ext, e.g. jpg or pngquality- the image quality- 返回:
- The thumbnail files array
- 抛出:
Exception
-
getBufferedImage
Get a BufferedImage from the image path and name- 参数:
imgPath- the image path and name- 返回:
- BufferedImage the BufferedImage
- 抛出:
IOException
-
toBufferedImage
Convert the Image to BufferedImage- 参数:
image- The source image- 返回:
- BufferedImage the BufferedImage
-
imageSave
Save the BufferedImage to file (JPEG, 0.8)- 参数:
buf- the BufferedImagename- the saved file path and name- 抛出:
IOException
-
imageSave
Save the BufferedImage to file (JPEG, 0.8)- 参数:
buf- the BufferedImagef1- the saved file- 抛出:
IOException
-
createResizedCopy
Create an image according to the new size- 参数:
originalImage- The original imagewidth- The new widthheight- The new height- 返回:
- The new size image
-
createClipCopy
public static BufferedImage createClipCopy(Image originalImage, int left, int top, int right, int bottom) Crop the image- 参数:
originalImage- The original imageleft- The crop lefttop- The crop topright- The crop rightbottom- The crop bottom- 返回:
- new BufferedImage
-
getBytes
Convert to BufferedImge to file buffer- 参数:
bi- The BufferedImageimageType- The save to image type JPEG, PNG ...- 返回:
- The file buffer
-