图片加水印文字,logo。生成缩略图
简单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。生成缩略图的更多相关文章
- c#封装DBHelper类 c# 图片加水印 (摘)C#生成随机数的三种方法 使用LINQ、Lambda 表达式 、委托快速比较两个集合,找出需要新增、修改、删除的对象 c# 制作正方形图片 JavaScript 事件循环及异步原理(完全指北)
c#封装DBHelper类 public enum EffentNextType { /// <summary> /// 对其他语句无任何影响 /// </summary> ...
- [原创]超强C#图片上传,加水印,自动生成缩略图源代码
<%@ Page Language=“C#“ AutoEventWireup=“true“ %> <%@ Import Namespace=“System“ %> <%@ ...
- php 图片加水印文字水印
/*给图片加文字水印的方法*/ $dst_path = 'http://f4.topitme.com/4/15/11/1166351597fe111154l.jpg';//保证路径正确 $dst = ...
- android图片加水印,文字
两种方法: 1.直接在图片上写文字 String str = "PICC要写的文字"; ImageView image = (ImageView) this.findViewByI ...
- Thumbnailator java图片压缩,加水印,批量生成缩略图
地址:http://code.google.com/p/thumbnailator/ 1.指定大小进行缩放 //size(宽度, 高度) /* * 若图片横比200小,高比300小,不变 * 若图片横 ...
- PHP图片加水印文字及图片合成缩放
<?php //图片添加文字水印 /*$bigImgPath = 'background.png'; $img = imagecreatefromstring(file_get_contents ...
- PHPThumb处理图片,生成缩略图,图片尺寸调整,图片截取,图片加水印,图片旋转
[强烈推荐]下载地址(github.com/masterexploder/PHPThumb). 注意这个类库有一个重名的叫phpThumb,只是大小写的差别,所以查找文档的时候千万注意. 在网站建设过 ...
- php对图片加水印--将文字作为水印加到图片
方法代码: /** * 图片加水印(适用于png/jpg/gif格式) * * @author flynetcn * * @param $srcImg 原图片 * @param $wat ...
- 使用 ImageEnView 给图片加水印,及建缩略图
摘要: 使用 ImageEnView 给图片加水印,及建缩略图 {Power by hzqghost@21cn.com}unit CutWater; interface uses Math,imag ...
随机推荐
- Nuxt.js使用mint-ui
环境 vue nuxt 要使用mint-ui 记录下其中的坑 npm install mint-ui --save plugins目录下 增加 mint-ui.js 代码: import Vue fr ...
- Linux C函数库大全
(1)字符测试函数 isalnum(测试字符是否为英文字母或数字) isalpha(测试字符是否为英文字母) isascii(测试字符是否为ASCII码字符) isblank(测试字符是否为空格字符) ...
- poj2482--Stars in Your Window(扫描线)
题目链接:点击打开链接 链接题目大意:给出n个星星的坐标,每一个星星有一个亮度.给出一个矩形的长和宽,问矩形能包含的星星的最大亮度和(不包含边框). 如果每个星星都是矩形的最左下点.那么每个星星都能够 ...
- 《C++ Primer Plus》学习笔记9
<C++ Primer Plus>学习笔记9 第15章 友元.异常和其他 <<<<<<<<<<<<<<& ...
- 用 centrifugo 搭建 消息推送服务器 docker + rancher 搭建
关于消息推送服务器 目前有很多第三方的开放成熟的推送服务.鉴于项目需要 我们项目需要自己搭建 自己的推送服务. 我们的推送应用场景 聊天消息 项目内部消息提醒 移动设备接受消息 应用到的相关软件工具知 ...
- c++面试题目(3)
这些东西有点烦,有点无聊.如果要去C++面试就看看吧.几年前网上搜索的.刚才看到,就整理一下,里面有些被我改了,感觉之前说的不对或不完善. 1.求下面函数的返回值( 微软) int func(x) ...
- mysql语法、特殊符号及正則表達式的使用
http://blog.csdn.net/pipisorry/article/details/46773545 sql语言 结构化的查询语言.(Structured Query Language),是 ...
- 查看windows下port占用
有时假tomcat启动时提示port被占用.能够用netstat -aon|findstr "8080" 命令查找到,然后 用 taskkill /f /pid pid号 强制ki ...
- 【Web前端】清除浮动&css中文字体
清理浮动有非常多种方式,像使用 br 标签自带的 clear 属,使用元素的 overflow.使用空标签来设置 clear:both 等等.但考虑到兼容问题和语义化的问题,一般我们都会使用例如以下代 ...
- java的nio包的SelectionKey,Selector,SelectableChannel三者的缠绵关系概述
猛击这里 java的nio包的SelectionKey,Selector,SelectableChannel三者的缠绵关系概述