简单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. Spring的IoC容器-Spring ApplicationContext容器

    Application Context是spring中较高级的容器.和BeanFactory类似,它可以加载配置文件中定义的bean,将所有的bean集中在一起,当有请求的时候分配bean. 另外,它 ...

  2. 用户空间&内核空间学习 & top命令 & time命令

    参考了这篇文章 http://www.ruanyifeng.com/blog/2016/12/user_space_vs_kernel_space.html 简单说,Kernel space 是 Li ...

  3. 转:国内Top500Android应用分析报告

    转自:https://mp.weixin.qq.com/s?__biz=MzA5OTMxMjQzMw==&mid=2648112527&idx=1&sn=b23c1b5f3e3 ...

  4. [React] Persist Form Data in React and Formik with formik-persist

    It can be incredibly frustrating to spend a few minutes filling out a form only to accidentally lose ...

  5. 133. Clone Graph (3 solutions)——无向无环图复制

    Clone Graph Clone an undirected graph. Each node in the graph contains a label and a list of its nei ...

  6. 深入JVM系列(二)之GC机制、收集器与GC调优(转)

    一.回顾JVM内存分配   需要了解更多内存模式与内存分配的,请看 深入JVM系列(一)之内存模型与内存分配 1.1.内存分配: 1.对象优先在EDEN分配2.大对象直接进入老年代 3.长期存活的对象 ...

  7. HDU1114 Piggy-Bank 【全然背包】

    Piggy-Bank Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total ...

  8. FLEX接收外部参数 .

    FLEX参数传递与FLASH有点不同 login..swf?name=aa&password=bb Flex上是这样接收参数的 myname=mx.core.Application.appli ...

  9. win32收不到F10按键消息解决的方法

    在WM_KEYDOWN中处理F10(VK_F10)消息总是获取不到,后来用spy++监听窗体消息发现按下F10并没有WM_KEYDOWN消息产生,而是产生了WM_SYSKEYDOWN

  10. mybatis一对多

    mapper.xml <mapper namespace="com.oracle.dao.one2manyDao"> <resultMap type=" ...