Question

is there any way to convert RGB image to grayscale using method that will make me able to convert the grayscale to RGB again (lossless method) ??

Was it helpful?

Solution

Yes and no. If you mean, "Can I destroy information and then later successfully retrieve it?" the answer is "No." If you mean, "Can I hide information and then later successfully retrieve it?" the answer is "Yes." Depending on the image's file format, there may be ways to embed the original RGB pixel data as a header that could later be read by custom software that you write.

Or I suppose you could save two files (original and grayscale) to the filesystem and link them in some looser way, like applying a file naming scheme that your custom software understands, or keeping a database that tells your custom software where to find the original and grayscale images. There are lots of ways you could choose to keep track of the connection between a grayscale image and its RGB source.

But if you mean, "Can I look at a single grayscale value for a pixel and clairvoyantly infer which three values (r, g, and b) were averaged (or otherwise mathematically combined) to derive that single grayscale value?" then the answer is "No." To prove this to yourself, consider that (10 + 10 + 10) / 3 is equal to (5 + 10 + 15) / 3. Given only the average value (10), can you reliably guess which three numbers were averaged to produce it? No.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top