Results 1 to 6 of 6

Thread: image

  1. #1
    Guest

    image

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

  2. #2
    Member Contributor
    Join Date
    Jan 2001
    Posts
    55

    Re: image

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

  3. #3
    Guest

    Re: image

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

  4. #4
    Guest

    Re: image

    is anyone able to help?? thanks.

  5. #5
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,753

    Re: image

    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)

    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];
       }
    }
    Deiussum
    Software Engineer and OpenGL enthusiast

  6. #6
    Senior Member OpenGL Guru zed's Avatar
    Join Date
    Nov 2010
    Posts
    2,466

    Re: image

    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
    }
    }

Similar Threads

  1. Replies: 1
    Last Post: 07-09-2017, 07:07 AM
  2. Replies: 1
    Last Post: 05-07-2017, 03:36 AM
  3. read gray image and color index image.
    By yjh1982 in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 08-21-2010, 04:09 AM
  4. Replies: 1
    Last Post: 01-31-2005, 11:01 AM
  5. problem in drawing a texture image(monochrome image)
    By philm in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 03-07-2003, 10:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean