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

最新文章

  1. C学习笔记
  2. SQL Server case表达式的用法
  3. express-9 Handlebars模板引擎(2)
  4. 19、文件上传与下载/JavaMail邮件开发
  5. javascript常用插件
  6. NOI题库05 派
  7. 中国天气网 JSON接口的城市编码解析及结果
  8. WebAPi接口安全之公钥私钥加密
  9. Tomcat部署war应用总结
  10. 将一个javaWeb应用跑在Docker里
  11. tyvj/joyoi 1336 火车进栈
  12. php环境和使用方法
  13. Python实现排列组合
  14. openpyxl 实现excel字母列号与数字列号之间的转换
  15. CCPC-Wannafly Winter Camp Day7 D---二次函数【数论】【构造】
  16. UML之组件图
  17. pyautogui控制鼠标键盘自动填写数据
  18. 【Python】Http Post请求四种请求体的Python实现
  19. 微软儿童编程技术,kodu(酷豆)为儿童创造一个游戏世界
  20. leetCode题解之寻找插入位置

热门文章

  1. cocos2dx 3.1从零学习(四)——内存管理(错误案例分析)
  2. Spring Boot热部署(springloader)
  3. 请教中文的OCR软件哪个最好?
  4. opencv源代码之中的一个:cvboost.cpp
  5. Hadoop权威指南学习笔记一
  6. 基于Nginx实现10万+并发,你应该做的Linux内核优化
  7. B+树在数据库中的应用
  8. posix多线程--线程私有数据
  9. Oracle PLSQL Demo - 12.定义包体[Define PACKAGE BODY]
  10. org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xm