public class ImageUtils extends Object
| Constructor and Description |
|---|
ImageUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
convertToPng(File srcFile,
File dstFile)
Convert image to png
|
static BufferedImage |
cropImage(BufferedImage originalImage,
int width,
int height)
Crop image to desired size
|
static String |
normalizeImageName(String value)
Normalize image name replacing non-alphanumeric characters by "_"
|
static BufferedImage |
resizeImage(BufferedImage originalImage,
int maxWidth,
int maxHeight)
Resize image to desired size
|
static BufferedImage |
resizeImage(File originalImageFile,
int maxWidth,
int maxHeight)
Resize image to desired size
|
static void |
resizeImageForAllAndroidDensities(String imageName,
File imageFile,
File tmpDirectory)
Resize image for all densities (ldpi/mdpi/hdpi/xhdpi/xxdpi)
|
static void |
resizeImageForAllAndroidDensities(String imageName,
File imageFile,
File tmpDirectory,
boolean force)
Deprecated.
|
static BufferedImage |
resizeImageSquare(BufferedImage originalImage,
int size)
Resize image to desired size
|
static BufferedImage |
resizeImageSquare(File originalImageFile,
int size)
Resize image to desired size
|
static void |
resizeImageToIcon(InputStream stream,
File destFile)
Resize image to fit icon specs
|
static void |
saveAndroidIcons(File icon,
File directory,
String iconName)
Export to android icons (ldpi/mdpi/hdpi/xhdpi/xxhdpi/xxxhdpi)
|
static void |
saveIosIcons(File icon,
File directory,
String iconName)
Export to ios icons (icon,icon@2x,40,40@2x,50,50@2x,60,60@2x,72,72@2x,76,76@2x,small,small@2x)
|
static void |
saveIosSplashScreens(File ss,
File directory)
Export to ios splashscreens
|
static void |
writeBufferedImageToFile(BufferedImage image,
File file)
Write buffered image to file
|
public static void resizeImageToIcon(InputStream stream, File destFile)
stream - the input stream of the imagedestFile - the destination filepublic static void saveAndroidIcons(File icon, File directory, String iconName)
icon - the icon filedirectory - the destination directorypublic static void saveIosIcons(File icon, File directory, String iconName)
icon - the icon filedirectory - the destination directorypublic static void saveIosSplashScreens(File ss, File directory)
ss - the splashscreen image filedirectory - the destination directorypublic static String normalizeImageName(String value)
@Deprecated public static void resizeImageForAllAndroidDensities(String imageName, File imageFile, File tmpDirectory, boolean force)
imageName - imageFile - tmpDirectory - force - public static void resizeImageForAllAndroidDensities(String imageName, File imageFile, File tmpDirectory)
imageName - imageFile - tmpDirectory - public static BufferedImage resizeImage(BufferedImage originalImage, int maxWidth, int maxHeight)
originalImage - the BufferedImagemaxWidth - the maximum width in pxmaxHeight - the maximum height in pxpublic static BufferedImage cropImage(BufferedImage originalImage, int width, int height)
originalImage - the BufferedImagewidth - the width in pxheight - the height in pxpublic static BufferedImage resizeImageSquare(BufferedImage originalImage, int size)
originalImage - the BufferedImagesize - the target size in pxpublic static BufferedImage resizeImageSquare(File originalImageFile, int size)
originalImageFile - the Filesize - the target size in pxpublic static BufferedImage resizeImage(File originalImageFile, int maxWidth, int maxHeight)
originalImageFile - the FilemaxWidth - the maximum width in pxmaxHeight - the maximum height in pxpublic static void convertToPng(File srcFile, File dstFile)
srcFile - the source filedstFile - the destination png filepublic static void writeBufferedImageToFile(BufferedImage image, File file)
image - the imagefile - the fileCopyright © 2015. All rights reserved.