How to cahnge pixel value with gray scale image?

Discussion in 'C++' started by Dev S Shrestha, Nov 11, 2003.

  1. I created a grayscale image

    Bitmap img(320,240,PixelFormat8bppIndexed);

    I want to set the BYTE values to each of the pixels using

    img.SetPixel(x,y,v);

    where v is a BYTE value between 0 and 255
    It did not work.

    Any solution?
     
    Dev S Shrestha, Nov 11, 2003
    #1
    1. Advertising

  2. Dev S Shrestha wrote:

    > I created a grayscale image
    >
    > Bitmap img(320,240,PixelFormat8bppIndexed);
    >
    > I want to set the BYTE values to each of the pixels using
    >
    > img.SetPixel(x,y,v);
    >
    > where v is a BYTE value between 0 and 255
    > It did not work.
    >
    > Any solution?
    >
    >


    Yes, please post the smallest amount of compilable code
    that demonstrates your issue. Please state the expected
    behavior as well as the actual behavior. Do not attach
    the code, just past it into your posting.

    Please read the FAQ and Welcome.Txt below for instructions
    on how to post.

    One reason that your call:
    img.SetPixel(x,y,v);
    did not 'work' is because x, or y may be out of range.
    There may be many other reasons too, but since you did
    not post any code, the world will never know.

    By the way, the C++ language does not have facilities
    for bitmaps and pixels. You need to ask the experts
    in a newsgroup about your compiler or platform. There
    are many listed in the C++ FAQ and Welcome.TXT listed
    below.

    --
    Thomas Matthews

    C++ newsgroup welcome message:
    http://www.slack.net/~shiva/welcome.txt
    C++ Faq: http://www.parashift.com/c -faq-lite
    C Faq: http://www.eskimo.com/~scs/c-faq/top.html
    alt.comp.lang.learn.c-c++ faq:
    http://www.raos.demon.uk/acllc-c /faq.html
    Other sites:
    http://www.josuttis.com -- C++ STL Library book
     
    Thomas Matthews, Nov 11, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Noozer
    Replies:
    5
    Views:
    52,465
  2. Sarath
    Replies:
    1
    Views:
    494
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=
    Oct 26, 2006
  3. =?Utf-8?B?QnJpYW4=?=
    Replies:
    0
    Views:
    357
    =?Utf-8?B?QnJpYW4=?=
    Oct 5, 2007
  4. André Wagner

    Fastest pixel by pixel operation

    André Wagner, Mar 17, 2008, in forum: Java
    Replies:
    12
    Views:
    1,081
    Larry A Barowski
    Mar 19, 2008
  5. kavitha
    Replies:
    0
    Views:
    2,637
    kavitha
    Jan 16, 2009
Loading...

Share This Page