简单JSP代码

图片加水银文字

try {
String path = request.getRealPath("images\\01.jpg");
out.print(path);
BufferedImage img = ImageIO.read(new FileInputStream(path));
out.print(img.getWidth());
out.print("<hr>");
out.print(img.getHeight());
Graphics g = img.getGraphics();
g.setColor(Color.YELLOW);
g.drawString("Hello 13014577033", 100, 200);
ImageIO.write(img, "jpg", new File("c:/t_01.jpg"));
} catch (Exception e) {
e.printStackTrace();
}

加logo

String path = request.getRealPath("images\\02.jpg");

    String npath = request.getRealPath("images\\s02.jpg");
ImageUtil iu = new ImageUtil(path);
iu.thumd(100,50,npath); String nnpath = request.getRealPath("images\\t02.jpg");
iu.txt("培训教育",30, nnpath); String logo = request.getRealPath("images\\fz.png");
String nn = request.getRealPath("images\\logot2.jpg");
iu.logo(logo, nn);

缩略图

try {
String path = request.getRealPath("images\\01.jpg");
BufferedImage img = ImageIO.read(new FileInputStream(path));
int w = img.getWidth();
int h = img.getHeight(); int ww = 200;
int hh = 150;
BufferedImage nimg = new BufferedImage(ww,hh,BufferedImage.TYPE_INT_RGB);
Graphics g = nimg.getGraphics();
g.drawImage(img, 0, 0, ww, hh, 0, 0, w, h, null);
ImageIO.write(nimg, "jpg", new File("c:/s_01.jpg"));
} catch (Exception e) {
e.printStackTrace();
}

Java类

http://www.cnblogs.com/Dreamlu/p/4151256.html

图片加水印文字,logo。生成缩略图的更多相关文章

  1. c#封装DBHelper类 c# 图片加水印 (摘)C#生成随机数的三种方法 使用LINQ、Lambda 表达式 、委托快速比较两个集合,找出需要新增、修改、删除的对象 c# 制作正方形图片 JavaScript 事件循环及异步原理(完全指北)

    c#封装DBHelper类   public enum EffentNextType { /// <summary> /// 对其他语句无任何影响 /// </summary> ...

  2. [原创]超强C#图片上传,加水印,自动生成缩略图源代码

    <%@ Page Language=“C#“ AutoEventWireup=“true“ %> <%@ Import Namespace=“System“ %> <%@ ...

  3. php 图片加水印文字水印

    /*给图片加文字水印的方法*/ $dst_path = 'http://f4.topitme.com/4/15/11/1166351597fe111154l.jpg';//保证路径正确 $dst = ...

  4. android图片加水印,文字

    两种方法: 1.直接在图片上写文字 String str = "PICC要写的文字"; ImageView image = (ImageView) this.findViewByI ...

  5. Thumbnailator java图片压缩,加水印,批量生成缩略图

    地址:http://code.google.com/p/thumbnailator/ 1.指定大小进行缩放 //size(宽度, 高度) /* * 若图片横比200小,高比300小,不变 * 若图片横 ...

  6. PHP图片加水印文字及图片合成缩放

    <?php //图片添加文字水印 /*$bigImgPath = 'background.png'; $img = imagecreatefromstring(file_get_contents ...

  7. PHPThumb处理图片,生成缩略图,图片尺寸调整,图片截取,图片加水印,图片旋转

    [强烈推荐]下载地址(github.com/masterexploder/PHPThumb). 注意这个类库有一个重名的叫phpThumb,只是大小写的差别,所以查找文档的时候千万注意. 在网站建设过 ...

  8. php对图片加水印--将文字作为水印加到图片

    方法代码: /**  * 图片加水印(适用于png/jpg/gif格式)  *  * @author flynetcn  *  * @param $srcImg  原图片  * @param $wat ...

  9. 使用 ImageEnView 给图片加水印,及建缩略图

    摘要: 使用 ImageEnView 给图片加水印,及建缩略图 {Power by hzqghost@21cn.com}unit CutWater; interface uses  Math,imag ...

随机推荐

  1. yum安装nginx详解

    原文:http://blog.csdn.net/tjcyjd/article/details/50686505 1.查看yum的nginx信息 # yum info nginx Loaded plug ...

  2. Spring自带mock测试Controller

    原文:http://blog.csdn.net/yin_jw/article/details/24726941 准备SpringMVC环境 注意:使用mock测试需要引入spring-test包 Ba ...

  3. pycharm、idea插件代理设置,插件安装

    pycharm和idea都是intellij的,所以插件安装是设置代理方法相似, 以pycharm举例: 1.已经安装的插件列表: 2.查找要安装的插件,没有,会给出下载插件的链接地址: 3.打开链接 ...

  4. Flash/Flex获取外部参数

    Part One:Flex程序如何获取html容器传递的URL参数值 我们经常在Flex程序需要用从外部html向swf文件传递参数,(类似 test.html?name=jex&addres ...

  5. 【转载】C# sleep 和wait的区别

    eep和wait都是使线程暂时停止执行的方法,但它们有很大的不同. 1. sleep是线程类Thread 的方法,它是使当前线程暂时睡眠,可以放在任何位置. 而wait,它是使当前线程暂时放弃对象的使 ...

  6. eclipse svn org.tigris.subversion.javahl.ClientException: RA layer request failed

    突然之间eclipse使用svn更新项目时报错,org.tigris.subversion.javahl.ClientException: RA layer request failed 网上搜的都是 ...

  7. openwrt hotplug

    由内核发出 event 事件. kobject_uevent() 产生 uevent 事件(lib/kobject_uevent.c 中), 产生的 uevent 先由 netlink_broadca ...

  8. WCF服务端的.NET Core支持项目Core WCF 正式启动

    长期以来在wcf客户端库 https://github.com/dotnet/wcf 里反应最强烈的就是.NET Core的服务端支持 https://github.com/dotnet/wcf/is ...

  9. React Native安装

    1.安装 1.1 安装Node.js 下载安装即可 1.2 安装Homebrew 终端中执行: $ /usr/bin/ruby -e "$(curl -fsSL https://raw.gi ...

  10. Jquery根据name取得所有选中的Checkbox值

    var spCodesTemp = "";            $('input:checkbox[name=supNO]:checked').each(function (i) ...