当前位置: 首页>>代码示例>>Java>>正文


Java IMOperation.addRawArgs方法代码示例

本文整理汇总了Java中org.im4java.core.IMOperation.addRawArgs方法的典型用法代码示例。如果您正苦于以下问题:Java IMOperation.addRawArgs方法的具体用法?Java IMOperation.addRawArgs怎么用?Java IMOperation.addRawArgs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.im4java.core.IMOperation的用法示例。


在下文中一共展示了IMOperation.addRawArgs方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convertWithOptions

import org.im4java.core.IMOperation; //导入方法依赖的package包/类
public byte[] convertWithOptions(InputStream image, String options) {
    String[] optionStrings = options.split(" ");
     
    IMOperation iMOperation = new IMOperation();
    iMOperation.addImage("-");
    iMOperation.addRawArgs(optionStrings);
    iMOperation.addImage(":-");
    
    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    
    Pipe pipeIn  = new Pipe(image, null);
    Pipe pipeOut = new Pipe(null, byteArrayOutputStream);
    
    ConvertCmd convertCmd = new ConvertCmd();
    convertCmd.setInputProvider(pipeIn);
    convertCmd.setOutputConsumer(pipeOut);
    
    try {
        convertCmd.run(iMOperation);
    } catch (IOException | InterruptedException | IM4JavaException exception) {
        System.err.println(exception.getMessage());
    }
    
    return byteArrayOutputStream.toByteArray();
}
 
开发者ID:exc-asia-and-europe,项目名称:imagemagick.xq,代码行数:26,代码来源:ConvertFunction.java

示例2: cropImageCenter

import org.im4java.core.IMOperation; //导入方法依赖的package包/类
/**
 * 头像处理 先压缩再裁剪
 * 
 * @param is
 * @param os
 * @param rectw
 * @param recth
 * @throws IOException
 * @throws InterruptedException
 * @throws IM4JavaException
 *
 */
public static void cropImageCenter(BufferedImage img, String descPath, int rectw, int recth) throws IOException, InterruptedException, IM4JavaException {

	IMOperation op = new IMOperation();
	
	op.addImage();

	op.resize(rectw, recth, '^').gravity("center").extent(rectw, recth).quality(100d);
	
	//去掉图片所有内置信息
	op.addRawArgs("+profile","*");
	
	op.addRawArgs("-quality","90.0");

	op.addImage();
	
	ConvertCmd cmd = new ConvertCmd(GraphicImageConstants.GM);

	cmd.run(op,img,descPath);

}
 
开发者ID:lklong,项目名称:imageweb,代码行数:33,代码来源:ImageUtil.java

示例3: addImageWaterMark

import org.im4java.core.IMOperation; //导入方法依赖的package包/类
/**
 * 给图片添加图片水印
 * 
 * @param waterPic
 *            水印图片
 * @param is
 * @param os
 * @throws IOException
 * @throws InterruptedException
 * @throws IM4JavaException
 *
 */
public static void addImageWaterMark(String waterPic, BufferedImage img, String descPath) throws IOException, InterruptedException, IM4JavaException {

	IMOperation op = new IMOperation();

	op.addImage(waterPic);

	op.gravity(GraphicImageConstants.GRAVITY);

	op.dissolve(GraphicImageConstants.DISSOLVE);

	//去掉图片所有内置信息
	op.addRawArgs("+profile","*");
	
	op.addRawArgs("-quality","90.0");
	
	op.addImage();

	CompositeCmd cmd = new CompositeCmd(GraphicImageConstants.GM);
	
	cmd.run(op, img,descPath);

}
 
开发者ID:lklong,项目名称:imageweb,代码行数:35,代码来源:ImageUtil.java

示例4: resizeImage

import org.im4java.core.IMOperation; //导入方法依赖的package包/类
/**
 * 图片压缩 严格按照指定规格压缩图片
 * 
 * @param width
 *            宽度
 * @param height
 *            高度
 * @param is
 * @param os
 * @throws IOException
 * @throws InterruptedException
 * @throws IM4JavaException
 *
 */
public static void resizeImage(Integer width, Integer height, Integer nWidth, Integer nHeight, BufferedImage img, String descPath) throws IOException, InterruptedException, IM4JavaException {

	if (nHeight >= height) {

		nHeight = height;

	}

	if (nWidth >= width) {

		nWidth = width;

	}

	IMOperation op = new IMOperation();
	
	op.addImage();

	op.resize(nWidth, nHeight, "!");
	
	//去掉图片所有内置信息
	op.addRawArgs("+profile","*");
	
	op.addRawArgs("-quality","90.0");

	op.addImage();
	
	ConvertCmd cmd = new ConvertCmd(GraphicImageConstants.GM);

	cmd.run(op,img,descPath);

}
 
开发者ID:lklong,项目名称:imageweb,代码行数:47,代码来源:ImageUtil.java

示例5: pressAndCutImage

import org.im4java.core.IMOperation; //导入方法依赖的package包/类
/**
 * 图片先压缩后裁切
 * 
 * @param width
 *            压缩宽度
 * @param height
 *            压缩高度
 * 
 * @param eWidth
 *            裁切宽度
 * @param eHeight
 *            裁切高度
 * 
 * @param is
 * @param os
 * @throws IOException
 * @throws InterruptedException
 * @throws IM4JavaException
 *
 */
public static void pressAndCutImage(Integer width, Integer height, Integer nWidth, Integer nHeight, Integer eWidth, Integer eHeight, BufferedImage img, String descPath) throws IOException,
		InterruptedException, IM4JavaException {

	if (nHeight >= height) {

		nHeight = height;

	}

	if (nWidth >= width) {

		nWidth = width;

	}

	IMOperation op = new IMOperation();
	
	op.addImage();

	op.resize(nWidth, nHeight, "^").extent(eWidth, eHeight);
	
	//去掉图片所有内置信息
	op.addRawArgs("+profile","*");
	
	op.addRawArgs("-quality","90.0");

	op.addImage();

	ConvertCmd cmd = new ConvertCmd(GraphicImageConstants.GM);

	cmd.run(op,img,descPath);

}
 
开发者ID:lklong,项目名称:imageweb,代码行数:54,代码来源:ImageUtil.java

示例6: cutAndPressImage

import org.im4java.core.IMOperation; //导入方法依赖的package包/类
/**
 * 图片先裁切后压缩
 * 
 * @param width
 *            压缩宽度
 * @param height
 *            压缩高度
 * 
 * @param eWidth
 *            裁切宽度
 * @param eHeight
 *            裁切高度
 * 
 * @param is
 * @param os
 * @throws IOException
 * @throws InterruptedException
 * @throws IM4JavaException
 *
 */
public static void cutAndPressImage(Integer width, Integer height, Integer eWidth, Integer eHeight, Integer nWidth, Integer nHeight, BufferedImage img, String descPath) throws IOException,
		InterruptedException, IM4JavaException {

	if (eHeight >= height) {

		eHeight = height;

	}

	if (eWidth >= width) {

		eWidth = width;

	}

	IMOperation op = new IMOperation();
	
	op.addImage();

	op.extent(eWidth, eHeight).resize(nWidth, nHeight, "^");
	
	//去掉图片所有内置信息
	op.addRawArgs("+profile","*");
	
	op.addRawArgs("-quality","90.0");

	op.addImage();

	ConvertCmd cmd = new ConvertCmd(GraphicImageConstants.GM);

	cmd.run(op,img,descPath);
	
}
 
开发者ID:lklong,项目名称:imageweb,代码行数:54,代码来源:ImageUtil.java

示例7: cutImageByPointAndWH

import org.im4java.core.IMOperation; //导入方法依赖的package包/类
/**
 * 图片裁切 根据坐标,指定宽高处理图片
 * 
 * @param is
 * @param os
 * @param height
 *            原始高度
 * @param width
 *            原始宽度
 * @param x
 *            起点横坐标
 * @param y
 *            起点纵坐标
 * @throws Exception
 *
 */
public static void cutImageByPointAndWH(BufferedImage img, String descPath, Integer height, Integer width, Integer nWidth, Integer nHeight, Integer x, Integer y) throws Exception {

	IMOperation op = new IMOperation();

	if (nHeight >= height) {

		nHeight = height;

	}

	if (nWidth >= width) {

		nWidth = width;

	}
	
	op.addImage();

	op.crop(nWidth, nHeight, x, y);

	//去掉图片所有内置信息
	op.addRawArgs("+profile","*");
	
	op.addRawArgs("-quality","90.0");
	
	op.addImage();

	ConvertCmd cmd = new ConvertCmd(GraphicImageConstants.GM);

	cmd.run(op,img,descPath);
}
 
开发者ID:lklong,项目名称:imageweb,代码行数:48,代码来源:ImageUtil.java

示例8: cutImageByPointWHAndPress

import org.im4java.core.IMOperation; //导入方法依赖的package包/类
/**
 * 先根据坐标和指定宽高裁切,再进行压缩
 * 
 * @param is
 * @param os
 * @param height
 * @param width
 * @param x
 * @param y
 * @param nWidth
 * @param nHeight
 * @param eWidth
 * @param eHeight
 * @throws Exception
 *
 */
public static void cutImageByPointWHAndPress(BufferedImage img, String descPath, Integer height, Integer width, Integer x, Integer y, Integer nWidth, Integer nHeight, Integer eWidth, Integer eHeight)
		throws Exception {

	if (nHeight >= height) {

		nHeight = height;

	}

	if (nWidth >= width) {

		nWidth = width;

	}

	IMOperation op = new IMOperation();
	
	op.addImage();

	op.crop(nWidth, nHeight, x, y).resize(eWidth, eHeight);

	//去掉图片所有内置信息
	op.addRawArgs("+profile","*");
	
	op.addRawArgs("-quality","90.0");
	
	op.addImage();

	ConvertCmd cmd = new ConvertCmd(GraphicImageConstants.GM);

	cmd.run(op,img,descPath);

}
 
开发者ID:lklong,项目名称:imageweb,代码行数:50,代码来源:ImageUtil.java

示例9: addWordWaterMark

import org.im4java.core.IMOperation; //导入方法依赖的package包/类
/**
 * 给图片添加文字水印
 * 
 * @param is
 * @param os
 * @param watermark
 *            水印内容
 * @param markparam
 * @throws IOException
 * @throws InterruptedException
 * @throws IM4JavaException
 *
 */
public static void addWordWaterMark(BufferedImage img, String descPath, String markparam) throws IOException, InterruptedException, IM4JavaException {

	IMOperation op = new IMOperation();
	
	op.addImage();

	op.font(GraphicImageConstants.FONT);

	op.fill(GraphicImageConstants.COLOR);

	op.pointsize(GraphicImageConstants.POINTSIZE);

	op.gravity(GraphicImageConstants.GRAVITY);

	op.dissolve(GraphicImageConstants.DISSOLVE);

	op.draw(markparam + GraphicImageConstants.WATERMARK);

	//去掉图片所有内置信息
	op.addRawArgs("+profile","*");
	
	op.addRawArgs("-quality","90.0");
	
	op.addImage();

	ConvertCmd cmd = new ConvertCmd(GraphicImageConstants.GM);

	cmd.run(op,img,descPath);

}
 
开发者ID:lklong,项目名称:imageweb,代码行数:44,代码来源:ImageUtil.java


注:本文中的org.im4java.core.IMOperation.addRawArgs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。