Click to See Complete Forum and Search --> : Image Processing


andrew_zep
August 17th, 2004, 03:05 AM
I am new to using WinAPI and I was wondering if there is a way to get RGB of each pixel of a JPEG image, row wise?

Thanks in advance.

Regards

sbubis
August 17th, 2004, 08:05 AM
As far as I know WinAPI doesn't contain something that allow you to access directly to jpeg object. To manipulate with image you need to convert jpeg to bmp and then you can use winAPI to access whatever you want.
However, to convert jpeg to BMP you need to download a library/sources (I worked with sources) from JPEG Internet site. There are good enough explanation and examples of "how to do".
Hopefully it's useful.

Takeru Koushirou
August 17th, 2004, 01:23 PM
Depending on the platform your code is designed for, newer Windows versions also can load Jpeg images with the LoadImage() function (I'm not really sure about this, but there's a way). But in general I also recommend to use an existing library which allows you to load and decode JPEG file.
Then you directly can access the pixels and get their R, G and B parts by some Bit Shifts. How to process the image is left for you - depending on the library you decided for, you either have a big array in memory containing the decoded image pixels or some other representation (which are often optimized for big images etc.). Or the library provides an API for their own image handle (common case).