locked
Problem with drawing into an gif file!!! RRS feed

  • Question

  • User1336889814 posted
    Hii al Rooms!! I have a problem when drawing to a gif Image.... When i run this code: Dim myBitmap As New Bitmap("D:\duongdi_print.gif") Dim imgFormat As Imaging.ImageFormat Dim myGrphics As Graphics myGrphics.FromImage(myBitmap) Dim myPen As New Pen(Color.Green) myGrphics.DrawLine(myPen, 0, 0, 100, 2) myBitmap.Save("D:\aa.gif") It's generate an error. But when i do it with a JPeg Image... there no thing I don't know how to draw into an gif image.. Someone please help me!!
    Monday, December 15, 2003 10:41 PM

All replies

  • User-599719271 posted
    what's the error message? they often prove useful.
    Wednesday, December 17, 2003 12:38 AM
  • User1336889814 posted
    "A Graphics object cannot be created from an image that has an indexed pixel format" ...
    Wednesday, December 17, 2003 5:20 AM
  • User-599719271 posted
    I get it - it's not a pronlem DRAWING the gif, it's a problem LOADING it, right? or at least,assigning it to a graphics object? try using a PNG or BMP as your source file. post note : I really should learn to spell. problem not pronlem
    Wednesday, December 17, 2003 7:13 AM
  • User1336889814 posted
    I Application is Maping... It must use very much Images (over 180MB Jpeg). I want to change all to GIF Image to reduce MB. So i want to draw into agif, not jpeg or png Can you give me an example "Drawing to a GIF file" I think there no problem with loading file..
    Wednesday, December 17, 2003 8:23 PM
  • User-599719271 posted
    you can't use indexed images with a graphics() object. i.e you CAN'T load a GIF into a Graphics object, because it's indexed. Hence the error. perhaps you should be loading a non-index source file in, drawing on it, then outputting to an indexed image? i.e if you load a GIF, first convert it to non-indexed before trying to draw on it, then convert it back. depending on how you go about it you could end up with little or no loss of quality.
    Wednesday, December 17, 2003 8:37 PM
  • User1336889814 posted
    YEs, thank!! I had done as you said... before i made a question in forum. I think there is a way that can draw directly into a GIF file (index image). Now i know it cannot. Thanks!!!!
    Wednesday, December 17, 2003 8:59 PM