Converting RGB image to the Grayscale image in Java

Nickson Joram
Javarevisited
Published in
6 min readNov 13, 2019

--

The topic! Conversion. We are spending a lot of time finding new things. But at the same time, we are spending a huge time finding the interconnection between the things which we’ve found!

Isn’t it?

Our objective

Before going into the topic deeper, let us see the basic definitions.

The RGB color model is an additive mixing model in which red, green, and blue light are added together in various ways to reproduce a broad array of colors.

Grayscale images, a kind of black-and-white or gray monochrome, are composed exclusively of shades of gray. The contrast ranges from black at the weakest intensity to white at the strongest.

We have a nice colorful image (say, RGB). And we are worrying about changing that image to a grayscale image. But why?

An RGB image consists of 3 layers as we saw above. Red, Green, Blue. It’s a 3-dimensional matrix. It is just like 3 consecutive pages in your book. But a grayscale image can…

--

--