grapes.image
类 Images

java.lang.Object
  继承者 grapes.image.Images

public class Images
extends java.lang.Object

图片操作(GIF、JPEG[PNG、BMP] 水印、缩放、裁切)

作者:
JSPGen

嵌套类摘要
static class Images.ImagesDatum
          成正比缩放基数
static class Images.ImagesNameGenre
          命名保存类型
 
字段摘要
static java.lang.String IMAGES
           
static int QUALITY
           
 
构造方法摘要
Images()
           
 
方法摘要
 boolean crop(java.lang.String srcFile, java.lang.String background, int cutX, int cutY, int cropWidth, int cropHeight)
           
 boolean crop(java.lang.String srcFile, java.lang.String background, int posX, int posY, int destWidth, int destHeight, int degree, int cutX, int cutY, int cropWidth, int cropHeight)
           
 boolean crop(java.lang.String srcFile, java.lang.String destFile, java.lang.String background, int cutX, int cutY, int cropWidth, int cropHeight)
           
 boolean crop(java.lang.String srcFile, java.lang.String destFile, java.lang.String background, int posX, int posY, int destWidth, int destHeight, int degree, int cutX, int cutY, int cropWidth, int cropHeight)
           
 boolean crop(java.lang.String srcFile, java.lang.String destFile, java.lang.String background, int quality, int posX, int posY, int destWidth, int destHeight, int degree, int cutX, int cutY, int cropWidth, int cropHeight)
           
 boolean crop(java.lang.String srcFile, java.lang.String destFile, java.lang.String background, int quality, int posX, int posY, int destWidth, int destHeight, int degree, int cutX, int cutY, int cropWidth, int cropHeight, boolean isGMK)
          图片裁切(构建顺序:先GMK 再Gif 最后JPEG) 前端JS组件建议采用: CropZoom插件(原图可移动,可旋转,可缩放)
static java.lang.String getFormatName(java.lang.Object obj)
          获取图片格式
 grapes.image.ImagesData getImagesData()
           
static Images.ImagesDatum getImagesDatum(java.lang.String str)
           
static Images.ImagesNameGenre getImagesNameGenre(java.lang.String str)
           
static boolean isImage(java.io.File file)
          判断文件类型是否为图片(编码+固定范围)
static boolean isSame(java.lang.Object obj1, java.lang.Object obj2)
          判断是否为同一张图片
static boolean isShow(java.awt.image.BufferedImage bufferedImage)
          判断是否能正常显示(JPEG[PNG、BMP])
static boolean isShow(com.gif4j.GifImage gifImage)
          判断是否能正常显示(GIF)
static boolean isShow(java.lang.Object obj)
          判断是否能正常显示(GIF、JPEG[PNG、BMP])
static com.gif4j.GifImage readGIFImage(java.lang.Object obj)
          读取图片(GIF)
static java.awt.image.BufferedImage readJPEGImage(java.lang.Object obj)
          读取图片(JPEG[PNG、BMP])
static boolean readURLGIFImage(java.lang.Object obj, java.lang.Object destObj, Images.ImagesNameGenre genre)
          读取网络图片(GIF)并保存输出[仅支持HTTP协议]
static com.gif4j.GifImage readURLGIFImage(java.lang.String urlFile)
          读取网络图片(GIF)[仅支持HTTP协议]
static boolean readURLImage(java.lang.String urlFile, java.lang.String destPath, Images.ImagesNameGenre genre)
          读取网络图片(GIF、JPEG[PNG、BMP])并保存输出[仅支持HTTP协议]
static boolean readURLJPEGImage(java.lang.Object obj, java.lang.Object destObj, Images.ImagesNameGenre genre)
          读取网络图片(JPEG[PNG、BMP])并保存输出[仅支持HTTP协议]
static java.awt.image.BufferedImage readURLJPEGImage(java.lang.String urlFile)
          读取网络图片(JPEG[PNG、BMP])[仅支持HTTP协议]
 void setImagesData(grapes.image.ImagesData imagesData)
           
 boolean watermark(java.lang.String srcFile, java.lang.String background, int position, int posX, int posY, int alpha, boolean isflag)
           
 boolean watermark(java.lang.String srcFile, java.lang.String destFile, java.lang.String background, int position, int posX, int posY, int alpha, boolean isflag)
           
 boolean watermark(java.lang.String srcFile, java.lang.String destFile, java.lang.String background, int quality, int position, int posX, int posY, int degree, int alpha, boolean isflag)
           
 boolean watermark(java.lang.String srcFile, java.lang.String destFile, java.lang.String background, int quality, int position, int posX, int posY, int degree, int alpha, boolean isflag, boolean isGMK)
          添加水印(构建顺序:先Gif 再GMK 最后JPEG)
static boolean writeImage(java.awt.image.BufferedImage bufferedImage, java.lang.Object destObj)
           
static boolean writeImage(java.awt.image.BufferedImage bfi, java.lang.Object destObj, int quality)
          输出图片(JPEG[PNG、BMP])
static boolean writeImage(com.gif4j.GifImage gifImage, java.lang.Object destObj)
          输出图片(GIF)
 boolean zoom(java.lang.String srcFile, java.lang.String background, int destWidth, int destHeight, int degree, boolean isamp, boolean isratio, Images.ImagesDatum datum)
           
 boolean zoom(java.lang.String srcFile, java.lang.String destFile, java.lang.String background, int destWidth, int destHeight, int degree, boolean isamp, boolean isratio, Images.ImagesDatum datum)
           
 boolean zoom(java.lang.String srcFile, java.lang.String destFile, java.lang.String background, int quality, int destWidth, int destHeight, int degree, boolean isamp, boolean isratio, Images.ImagesDatum datum)
           
 boolean zoom(java.lang.String srcFile, java.lang.String destFile, java.lang.String background, int quality, int destWidth, int destHeight, int degree, boolean isamp, boolean isratio, Images.ImagesDatum datum, boolean isGMK)
          图片缩放(构建顺序:先GMK 再Gif 最后JPEG)
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

IMAGES

public static final java.lang.String IMAGES
另请参见:
常量字段值

QUALITY

public static final int QUALITY
另请参见:
常量字段值
构造方法详细信息

Images

public Images()
方法详细信息

getImagesData

public grapes.image.ImagesData getImagesData()

setImagesData

public void setImagesData(grapes.image.ImagesData imagesData)

getImagesDatum

public static Images.ImagesDatum getImagesDatum(java.lang.String str)

getImagesNameGenre

public static Images.ImagesNameGenre getImagesNameGenre(java.lang.String str)

getFormatName

public static java.lang.String getFormatName(java.lang.Object obj)
获取图片格式

参数:
obj - 文件对象(地址)
返回:
String

isImage

public static boolean isImage(java.io.File file)
判断文件类型是否为图片(编码+固定范围)

参数:
file - 当前文件
返回:
boolean

isSame

public static boolean isSame(java.lang.Object obj1,
                             java.lang.Object obj2)
判断是否为同一张图片

参数:
obj1 - 原图对象1(地址)
obj2 - 原图对象2(地址)
返回:
boolean

isShow

public static boolean isShow(java.lang.Object obj)
判断是否能正常显示(GIF、JPEG[PNG、BMP])

参数:
obj - 文件对象(地址)
返回:
boolean

isShow

public static boolean isShow(com.gif4j.GifImage gifImage)
判断是否能正常显示(GIF)

参数:
gifImage - 图片对象
返回:
boolean

isShow

public static boolean isShow(java.awt.image.BufferedImage bufferedImage)
判断是否能正常显示(JPEG[PNG、BMP])

参数:
bufferedImage - 图片对象
返回:
boolean

writeImage

public static boolean writeImage(com.gif4j.GifImage gifImage,
                                 java.lang.Object destObj)
输出图片(GIF)

参数:
gifImage - 图片对象
destObj - 保存对象(路径、文件、输出流:response.getOutputStream())
返回:
boolean

writeImage

public static boolean writeImage(java.awt.image.BufferedImage bfi,
                                 java.lang.Object destObj,
                                 int quality)
输出图片(JPEG[PNG、BMP])

参数:
bfi - 图片对象
destObj - 保存对象(路径、文件、输出流:response.getOutputStream())
quality - 图片质量(0-100 默认85)
返回:
boolean

writeImage

public static boolean writeImage(java.awt.image.BufferedImage bufferedImage,
                                 java.lang.Object destObj)

readGIFImage

public static com.gif4j.GifImage readGIFImage(java.lang.Object obj)
读取图片(GIF)

参数:
obj - 图片对象(地址、File、InputStream)
返回:
GifImage

readJPEGImage

public static java.awt.image.BufferedImage readJPEGImage(java.lang.Object obj)
读取图片(JPEG[PNG、BMP])

参数:
obj - 图片对象(地址、File、InputStream)
返回:
BufferedImage

readURLGIFImage

public static com.gif4j.GifImage readURLGIFImage(java.lang.String urlFile)
读取网络图片(GIF)[仅支持HTTP协议]

参数:
urlFile - 网络地址
返回:
GifImage

readURLJPEGImage

public static java.awt.image.BufferedImage readURLJPEGImage(java.lang.String urlFile)
读取网络图片(JPEG[PNG、BMP])[仅支持HTTP协议]

参数:
urlFile - 网络地址
返回:
BufferedImage

readURLGIFImage

public static boolean readURLGIFImage(java.lang.Object obj,
                                      java.lang.Object destObj,
                                      Images.ImagesNameGenre genre)
读取网络图片(GIF)并保存输出[仅支持HTTP协议]

参数:
obj - 原图对象(网络地址)
destObj - 保存对象(地址、输出流:response.getOutputStream())
genre - 名称保存类型
返回:
boolean

readURLJPEGImage

public static boolean readURLJPEGImage(java.lang.Object obj,
                                       java.lang.Object destObj,
                                       Images.ImagesNameGenre genre)
读取网络图片(JPEG[PNG、BMP])并保存输出[仅支持HTTP协议]

参数:
obj - 原图对象(网络地址)
destObj - 保存对象(地址、输出流:response.getOutputStream())
genre - 名称保存类型
返回:
boolean

readURLImage

public static boolean readURLImage(java.lang.String urlFile,
                                   java.lang.String destPath,
                                   Images.ImagesNameGenre genre)
读取网络图片(GIF、JPEG[PNG、BMP])并保存输出[仅支持HTTP协议]

参数:
urlFile - 网络地址
destPath - 保存目录
genre - 保存名称类型
返回:
boolean

watermark

public boolean watermark(java.lang.String srcFile,
                         java.lang.String destFile,
                         java.lang.String background,
                         int quality,
                         int position,
                         int posX,
                         int posY,
                         int degree,
                         int alpha,
                         boolean isflag,
                         boolean isGMK)
添加水印(构建顺序:先Gif 再GMK 最后JPEG)

参数:
srcFile - 原图地址
destFile - 保存地址
background - 空白背景色
quality - 图片质量(0-100 默认85)
position - 定位方式(-1-10,-1为自定义、0为随机、10为平铺)
posX - 水印X轴坐标(定位方式为-1时启用)
posY - 水印Y轴坐标(定位方式为-1时启用)
degree - 旋转角度
alpha - 透明度
isflag - 文字水印
isGMK - 启用GraphicsMagick(默认启用)
返回:
String

watermark

public boolean watermark(java.lang.String srcFile,
                         java.lang.String destFile,
                         java.lang.String background,
                         int quality,
                         int position,
                         int posX,
                         int posY,
                         int degree,
                         int alpha,
                         boolean isflag)

watermark

public boolean watermark(java.lang.String srcFile,
                         java.lang.String destFile,
                         java.lang.String background,
                         int position,
                         int posX,
                         int posY,
                         int alpha,
                         boolean isflag)

watermark

public boolean watermark(java.lang.String srcFile,
                         java.lang.String background,
                         int position,
                         int posX,
                         int posY,
                         int alpha,
                         boolean isflag)

zoom

public boolean zoom(java.lang.String srcFile,
                    java.lang.String destFile,
                    java.lang.String background,
                    int quality,
                    int destWidth,
                    int destHeight,
                    int degree,
                    boolean isamp,
                    boolean isratio,
                    Images.ImagesDatum datum,
                    boolean isGMK)
图片缩放(构建顺序:先GMK 再Gif 最后JPEG)

参数:
srcFile - 原图地址
destFile - 保存地址
background - 空白背景色
quality - 图片质量(0-100 默认85)
destWidth - 缩放后图片宽度
destHeight - 缩放后图像高度
degree - 旋转角度
isamp - 是否放大处理(小于指定宽高则进行放大)
isratio - 是否成正比缩放
datum - 成正比缩放基数(auto:自动, width、height:以宽度还是高度为准成正比缩放)
isGMK - 启用GraphicsMagick(默认启用)
返回:
String

zoom

public boolean zoom(java.lang.String srcFile,
                    java.lang.String destFile,
                    java.lang.String background,
                    int quality,
                    int destWidth,
                    int destHeight,
                    int degree,
                    boolean isamp,
                    boolean isratio,
                    Images.ImagesDatum datum)

zoom

public boolean zoom(java.lang.String srcFile,
                    java.lang.String destFile,
                    java.lang.String background,
                    int destWidth,
                    int destHeight,
                    int degree,
                    boolean isamp,
                    boolean isratio,
                    Images.ImagesDatum datum)

zoom

public boolean zoom(java.lang.String srcFile,
                    java.lang.String background,
                    int destWidth,
                    int destHeight,
                    int degree,
                    boolean isamp,
                    boolean isratio,
                    Images.ImagesDatum datum)

crop

public boolean crop(java.lang.String srcFile,
                    java.lang.String destFile,
                    java.lang.String background,
                    int quality,
                    int posX,
                    int posY,
                    int destWidth,
                    int destHeight,
                    int degree,
                    int cutX,
                    int cutY,
                    int cropWidth,
                    int cropHeight,
                    boolean isGMK)
图片裁切(构建顺序:先GMK 再Gif 最后JPEG) 前端JS组件建议采用: CropZoom插件(原图可移动,可旋转,可缩放)

参数:
srcFile - 原图地址
destFile - 保存地址
background - 空白背景色
quality - 图片质量(0-100 默认85)
posX - 原图X轴坐标(默认0,相对于编辑区,为计算起始点在原图上的坐标服务)
posY - 原图Y轴坐标(默认0,相对于编辑区,为计算起始点在原图上的坐标服务)
destWidth - 原图缩放宽度(大于0时管用)
destHeight - 原图缩放高度(大于0时管用)
degree - 原图旋转角度
cutX - 裁切X轴坐标(起始点,相对于编辑区)
cutY - 裁切Y轴坐标(起始点,相对于编辑区)
cropWidth - 裁切宽度(终止点)
cropHeight - 裁切高度(终止点)
isGMK - 启用GraphicsMagick(默认启用)
返回:
String

crop

public boolean crop(java.lang.String srcFile,
                    java.lang.String destFile,
                    java.lang.String background,
                    int quality,
                    int posX,
                    int posY,
                    int destWidth,
                    int destHeight,
                    int degree,
                    int cutX,
                    int cutY,
                    int cropWidth,
                    int cropHeight)

crop

public boolean crop(java.lang.String srcFile,
                    java.lang.String destFile,
                    java.lang.String background,
                    int posX,
                    int posY,
                    int destWidth,
                    int destHeight,
                    int degree,
                    int cutX,
                    int cutY,
                    int cropWidth,
                    int cropHeight)

crop

public boolean crop(java.lang.String srcFile,
                    java.lang.String destFile,
                    java.lang.String background,
                    int cutX,
                    int cutY,
                    int cropWidth,
                    int cropHeight)

crop

public boolean crop(java.lang.String srcFile,
                    java.lang.String background,
                    int posX,
                    int posY,
                    int destWidth,
                    int destHeight,
                    int degree,
                    int cutX,
                    int cutY,
                    int cropWidth,
                    int cropHeight)

crop

public boolean crop(java.lang.String srcFile,
                    java.lang.String background,
                    int cutX,
                    int cutY,
                    int cropWidth,
                    int cropHeight)