473,387 Members | 1,592 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to cahnge pixel value with gray scale image?

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
1 3260
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Akbarr | last post by:
I'm using JAI for reading Tiff images: black and white, 1 bit depth. I want to scale them to reduce their size, but I want to do antialiasing. If I scale them as they are (using the scale operator)...
7
by: TomHL | last post by:
hello, - I have a Bitmap Object named: bmp1 - I already have the numerical values of:red,blue and green colors + I have the X and Y cordinates. How do I set the pixel value via safe code on...
30
by: Chaos | last post by:
As my first attempt to loop through every pixel of an image, I used for thisY in range(0, thisHeight): for thisX in range(0, thisWidth): #Actions here for Pixel thisX, thisY But it takes...
10
by: Lucas | last post by:
I want to change some pixel value in the picture file. how to do it? If I read the file in binary mode, a bit == a pixel ? Thanks
0
by: Gregory Piñero | last post by:
I want to be able to randomly change pixels in an image and view the results. I can use whatever format of image makes this easiest, e.g., gray scale, bit tonal, etc. Ideally I'd like to keep...
1
by: vidhyam816 | last post by:
Hi Friends, Can I have a VB program to find the pixel value of an gray image with bitmap format,
2
archonmagnus
by: archonmagnus | last post by:
Hello all, I've been experimenting with developing an orbital analysis program. Being a visually oriented person, I'd like to translate my (x, y) coordinate pairs to an pixel image array so I can...
9
by: raylopez99 | last post by:
After refering to the below thread, I take it for C# Forms 2.0, there a way to draw a 1 pixel by 1 pixel rectangle, which I was able to do just now successfully. ...
0
by: Kevinst | last post by:
Hello, currently I am working on the following scenario: There is a device connected to my application. That device has a 256x256 pixel display showing graphics and text. Now for each pixel...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.