PDA

View Full Version : image



02-24-2001, 07:50 PM
please tell me how to flip an image(JPEG file)? and also how to create a lumnance version of that image?

lee
02-24-2001, 11:12 PM
flip an image? do you mean vertically and horizontally? or are you talking about something different?

02-24-2001, 11:43 PM
sorry, that i did not state it clearly. flip the image horizontally. thanks.

02-25-2001, 11:50 AM
is anyone able to help?? thanks.

Deiussum
02-25-2001, 04:12 PM
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[x][y], img.data[img.width-x-1][y];
}
}

zed
02-25-2001, 06:51 PM
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
}
}