简单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. 【Android开发—智能家居系列】(四):UDP通信发送指令

    思路回顾 [1]手机连接WIFI模块 [2]UDP通信对WIFI模块发送指令,以和WIFI模块保持连接状态 [3]UDP通信对WIFI模块发送指令,让其搜索可用的无线网,返回WIFI列表 [4]发送指 ...

  2. [React] Use React.memo with a Function Component to get PureComponent Behavior

    A new Higher Order Component (HOC) was recently released in React v16.6.0 called React.memo. This be ...

  3. React 组件开发注意事项

    0.state的设定原则,如果render里用不到,则就不应该是一个state. 1.数组遍历时,用每一条数据的唯一标识作为key,尽量不要使用遍历的索引值作为key,如果它们从不重新排序,它们工作也 ...

  4. android-----JNI中的log打印

    1. 导入log头文件 在你使用的 .c/ .cpp 文件中 导入 log.h 头文件 #include<android/log.h> 2.在Android.mk 中 加上 LOCAL_L ...

  5. C#中使用byte[]数据,生成Bitmap

    /// <summary> /// 使用byte[]数据,生成256色灰度 BMP 位图 /// </summary> /// <param name="ori ...

  6. android项目笔记(一)

    1.getInstance:单例模式创建类的实例,getInstance在单例模式(保证一个类仅有一个实例,并提供一个访问它的全局访问点)的类中常见,用来生成唯一的实例,getInstance往往是s ...

  7. a#x#i#o#s封装

    封装的js文件如下: /* 用于修改 axios 的一些公用配置,具体参看文档 */import axios from 'axios'import store from '@/store/index. ...

  8. C#文件的压缩和解压(ZIP)使用DotNetZip封装类操作zip文件(创建/读取/更新)实例

    需要引用Ionic.Zip命名空间 DLL下载地址在这里:http://dotnetzip.codeplex.com/ 文件压缩 /// <summary> /// 压缩ZIP文件 /// ...

  9. Distributed Management Task Force----分布式管理任务组

    http://baike.baidu.com/link?url=Y9HGLs8Qj6pXbbgY6xPdfiGDsQO8Eu1e80B4giQtQ_hAfGNF59byxnLoERYri4Duw7Gw ...

  10. Cocos2d-x学习资源

    1.CSDN博客:http://blog.csdn.net/legendof1991/article/category/2161091.主要讲的Cocos2d-x3.0 2.CSDN博客:http:/ ...