I am working with 24×24 pixel icons. And I would like to be able to change a specific color within this icon to a different color. For example turn the white areas to red.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I don’t know of an API method that does that. And by default,
Imagesare not writable. However, if you have aBufferedImage, you could do it like this:This is not the most efficient way to do it (it’s possible to fetch RGB data into an array instead of one pixel at a time), but for 24×24 images it shouldn’t be a problem.