Answer the question
In order to leave comments, you need to log in
Java RGB to int?
What is the best way to extract RGB from an image into an array? Which array is better to use (one-dimensional, two-dimensional, three-dimensional), type byte or int ? if the type is int, then it is added from R+G+B , but when it is converted back, how does it know what initial data is?? I need to work with photo effects, help!
Answer the question
In order to leave comments, you need to log in
A 32-bit int allows you to store the exact color value in a 24-bit palette (that's just R + G + B) plus 255 gradations of transparency. Accordingly, it is permissible to store the picture in a one-dimensional int array by setting an additional variable to store the width of the picture (in order to know at what point the "line wrapping" should be performed). The selection of individual channels is the usual work with bytes (see byte shift), and the imposition of effects is, in general, a topic for a separate conversation).
In addition, Java provides the java.awt.Color class, which makes it easy to work with color.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question