Graphics object doesn't play well with indexed pixel format. RRS feed

  • Question

  • I am working with black and white tiff files - specifically I would like to create and place text as well as graphics inside of them. 

    However, the following code produces an exception:

                Bitmap myBitmap = new Bitmap(100, 100, PixelFormat.Format1bppIndexed);

                    using (Graphics g = Graphics.FromImage(myBitmap))
                        //do some work
                catch (Exception e)

    The exception created is:

    A Graphics object cannot be created from an image that has an indexed pixel format. 

    My questions are:


    Will this ever be fixed?

    Is there a work around?

    Tuesday, September 19, 2006 4:56 PM


  • GDI+ has very poor support for indexed pixel formats.  Load and save, that's about it.  I seriously doubt this will ever get fixed.
    Tuesday, September 19, 2006 10:22 PM