e680. 使三元色图像变明变暗
2024-09-04 09:44:07
This example demonstrates how to brighten or darken an RGB buffered image by scaling the red, green, and blue values in the image.
// To create a buffered image, see e666 创建缓冲图像 // Brighten the image by 30%
float scaleFactor = 1.3f;
RescaleOp op = new RescaleOp(scaleFactor, 0, null);
bufferedImage = op.filter(bufferedImage, null); // Darken the image by 10%
scaleFactor = .9f;
op = new RescaleOp(scaleFactor, 0, null);
bufferedImage = op.filter(bufferedImage, null);
If the image is not an RGB image, the following code converts a non-RGB image to an RGB buffered image:
// Get non-RGB image
Image image = new ImageIcon("image.gif").getImage(); // Create an RGB buffered image
BufferedImage bimage = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_RGB); // Copy non-RGB image to the RGB buffered image
Graphics2D g = bimage.createGraphics();
g.drawImage(image, 0, 0, null);
g.dispose();
Related Example |
最新文章
- C学习笔记
- SQL Server case表达式的用法
- express-9 Handlebars模板引擎(2)
- 19、文件上传与下载/JavaMail邮件开发
- javascript常用插件
- NOI题库05 派
- 中国天气网 JSON接口的城市编码解析及结果
- WebAPi接口安全之公钥私钥加密
- Tomcat部署war应用总结
- 将一个javaWeb应用跑在Docker里
- tyvj/joyoi 1336 火车进栈
- php环境和使用方法
- Python实现排列组合
- openpyxl 实现excel字母列号与数字列号之间的转换
- CCPC-Wannafly Winter Camp Day7 D---二次函数【数论】【构造】
- UML之组件图
- pyautogui控制鼠标键盘自动填写数据
- 【Python】Http Post请求四种请求体的Python实现
- 微软儿童编程技术,kodu(酷豆)为儿童创造一个游戏世界
- leetCode题解之寻找插入位置
热门文章
- cocos2dx 3.1从零学习(四)——内存管理(错误案例分析)
- Spring Boot热部署(springloader)
- 请教中文的OCR软件哪个最好?
- opencv源代码之中的一个:cvboost.cpp
- Hadoop权威指南学习笔记一
- 基于Nginx实现10万+并发,你应该做的Linux内核优化
- B+树在数据库中的应用
- posix多线程--线程私有数据
- Oracle PLSQL Demo - 12.定义包体[Define PACKAGE BODY]
- org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xm