Set Color as int value for use in setRGB(int x, int y, int rgb) method? — Java
Any other errors aside, I need a way of converting my Color grayScale into an int. When I plug in the Color, I get an error. setRGB method takes an x, a y, and an rgb int as parameters. How do I change my Color into an int? import java.awt.*; import java.awt.event.*; import java.util.*; import java.io.*; import javax.swing.*; import java.awt.image.*; import javax.imageio.ImageIO; public class Picture{ Container content; BufferedImage image, image2; public Picture(String filename) { File f = new File(filename); //assume file is the image file try { image = ImageIO.read(f); } catch (IOException