image

please tell me how to flip an image(JPEG file)? and also how to create a lumnance version of that image?

flip an image? do you mean vertically and horizontally? or are you talking about something different?

sorry, that i did not state it clearly. flip the image horizontally. thanks.

is anyone able to help?? thanks.

The hardest part of that will be reading in the raw data for the JPEG. There are libraries that can be used for this, though. (I’m not sure of any URLs offhand, I prefer to do my own image loading.)

Once you have the raw data, you can flip it doing something like so… (pseudo-code)

for (int y=0; y<img.height;y++)
{
for (int x=0;x<img.width/2;x++)
{
SwapPixel(img.data[y], img.data[img.width-x-1][y];
}
}

to flip use this when u rad the data in

for (int y=0; y<img.height;y++)
{
for (int x=0;x<img.width;x++)
{
image [x + (imageheight-1-y)*imageheight ] = data
}
}