By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,134 Members | 1,942 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,134 IT Pros & Developers. It's quick & easy.

How to cahnge pixel value with gray scale image?

P: n/a
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?
Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.