public class GraphicsMagickHelper extends Object
GraphicsMagick + im4java 实现高质量大图的处理
| 构造器和说明 |
|---|
GraphicsMagickHelper() |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
cropImage(String imagePath,
String newPath,
int x,
int y,
int width,
int height)
裁剪图片
|
static void |
cropImageCenter(String srcPath,
String desPath,
int rectw,
int recth)
先缩放,后居中切割图片
|
static String |
cropImageQuality(int width,
int height,
String srcPath,
String newPath,
int type,
String quality)
根据尺寸缩放图片
|
static String |
getImageInfo(String imagePath)
图片信息
|
org.im4java.core.IMOperation |
getOpWaterMark(String filePath)
功能描述:水印的操作接口,水印图片将会被印在右下角,透明度为80,位偏移量x轴10像素,y轴5像素的位置
|
protected static org.im4java.core.ConvertCmd |
localConvertCmd()
获得 ConvertCmd
windows 环境设置 convert.setSearchPath
|
boolean |
rotate(String imagePath,
String newPath,
double degree)
图片旋转
|
static void |
zoom(String srcPath,
String destinationPath,
int quality)
按照规定的尺寸对图片进行缩放
|
static void |
zoom(String srcPath,
String destinationPath,
int needWidth,
int needHeight,
int quality)
按照规定的尺寸对图片进行缩放
|
protected static org.im4java.core.ConvertCmd localConvertCmd()
windows 环境设置 convert.setSearchPath
public boolean rotate(String imagePath, String newPath, double degree)
imagePath - 源图片路径newPath - 处理后图片路径degree - 旋转角度public boolean cropImage(String imagePath, String newPath, int x, int y, int width, int height)
imagePath - 源图片路径newPath - 处理后图片路径x - 起始X坐标y - 起始Y坐标width - 裁剪宽度height - 裁剪高度public static String cropImageQuality(int width, int height, String srcPath, String newPath, int type, String quality) throws Exception
width - 缩放后的图片宽度height - 缩放后的图片高度srcPath - 源图片路径newPath - 缩放后图片的路径type - 1为比例处理,2为大小处理,如(比例:1024x1024,大小:50%x50%)Exceptionpublic static void zoom(String srcPath, String destinationPath, int needWidth, int needHeight, int quality) throws Exception
srcPath - 需要缩放的源文件路径destinationPath - 生成图片的目标路径needWidth - 需要缩放的宽度needHeight - 需要缩放的高度quality - 图片的质量,0~25:差,50~75:中等,75~100高Exceptionpublic static void zoom(String srcPath, String destinationPath, int quality) throws Exception
srcPath - 需要缩放的源文件路径destinationPath - 生成图片的目标路径quality - 图片的质量,0~25:差,50~75:中等,75~100高Exceptionpublic org.im4java.core.IMOperation getOpWaterMark(String filePath)
filePath - 源图片路径,这里生成的目标图片路径将覆盖掉源图片public static void cropImageCenter(String srcPath, String desPath, int rectw, int recth) throws IOException, InterruptedException, org.im4java.core.IM4JavaException
srcPath - 源图路径desPath - 目标图保存路径rectw - 待切割在宽度recth - 待切割在高度org.im4java.core.IM4JavaExceptionInterruptedExceptionIOExceptionCopyright © 2016. All rights reserved.