Edit pixel values

与世无争的帅哥 提交于 2019-11-30 04:54:51

问题


How to edit pixel values of an image in Java. Is there any method to change pixel values?


回答1:


For example:

BufferedImage image = ...
image.setRGB(x, y, 0);

From documentation:

 void setRGB(int x, int y, int rgb)
 //Sets a pixel in this BufferedImage to the specified RGB value.



回答2:


In BufferedImage: public void setRGB(int x, int y, int rgb)

Sets a pixel in this BufferedImage to the specified RGB value. The pixel is assumed to be in the default RGB color model, TYPE_INT_ARGB, and default sRGB color space. For images with an IndexColorModel, the index with the nearest color is chosen.

http://download.oracle.com/javase/6/docs/api/java/awt/image/BufferedImage.html



来源:https://stackoverflow.com/questions/5702397/edit-pixel-values

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!