473,403 Members | 2,338 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,403 software developers and data experts.

Creating Indexed Image on the fly

Hello,

I'm tring to create an indexed image on the fly with the following :

Bitmap bcodeBitmap = new Bitmap(50,50,PixelFormat.Format32bppArgb);
Graphics objGraphics = Graphics.FromImage(bcodeBitmap);

objGraphics.FillRectangle(new SolidBrush(Color.White), new
Rectangle(0,0,50,50));
objGraphics.DrawString("hello", System.Drawing.Font, new
SolidBrush(Color.Black),10,0);

Would have liked to use PixelFormat.Format1bppIndexed when creating the
bitmap but this gives : System.Exception: A Graphics object cannot be
created from an image that has an indexed pixel format

Does anyone know how to index this image and avoid the exception....Thanks
in advance.
Nov 16 '05 #1
0 1505

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: noelwatson | last post by:
I am looking to create a constraint on a table that allows multiple nulls but all non-nulls must be unique. I found the following script http://www.windowsitpro.com/Files/09/21293/Listing_01.txt...
1
by: James Dean | last post by:
I want to put my own custom colors in the Pallete.....could someone tell me how to do this?. I tried the following: bitmap.Palette.Entries.SetValue(Color.White,0); This was supposed to set the...
1
by: jty202 | last post by:
I know alot of people have the problem with indexed pixel format. I hope someone can show me the solution to this.I am have problem with graphics with the following code giving the error: "A...
1
by: Jeff Stewart | last post by:
Is there a procedure for determining whether or not an Image uses any of the indexed pixel formats, short of checking against each one? -- Jeff S.
8
by: **Developer** | last post by:
Seems that Dot.net can not handle files of Indexed Pixel Format as well as other types of formats. Given a file or and Image of type Indexed Pixel Format is there a method to convert it to some...
3
by: aldonnelley | last post by:
Hi there. I'm just learning c++, and this is driving me nuts. I'm trying to save image files generated in a for loop with a filename built using strcat with: - a char base file name + a...
8
by: Joergen Bech | last post by:
Suppose I have Dim bm As New Bitmap(16, 16,Imaging.PixelFormat.Format8bppIndexed) I cannot use Dim g As Graphics = Graphics.FromImage(bmdest) Dim hdc As IntPtr = g.GetHdc() as the...
9
by: colin | last post by:
Hi, I have all the components of a .bmp file in memory wich i need to write to a .bmp file, (or other convenient image file) ie i have 256 color pallete of RGBquads and array of 8bit pixels, I...
1
by: Nathan Sokalski | last post by:
I have created declared a Bitmap using the following statement: Dim bmp As New Bitmap(100, 100, PixelFormat.Format8bppIndexed) Because the SetPixel() method is disabled and a Graphics object...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.