none
How to Load a GIF File into a Bitmap Object?

    Question

  • Hi all,

    i have a GIF file that is created from a Bitmap object outside CF using:

    Bitmap bitmap = new Bitmap(640, 480);
    bitmap.Save("temp.gif", ImageFormat.Gif);

    If i copy this temp.gif to the emulator and try to load it using:

    Bitmap bitmap = new Bitmap("temp.gif");

    i get an ArgumentException.


    However, if i save it as a BMP, i.e.:

    Bitmap bitmap = new Bitmap(640, 480);
    bitmap.Save("temp.bmp", ImageFormat.Bmp);

    and load it:

    Bitmap bitmap = new Bitmap("temp.bmp");

    it loads ok.



    Is it possible to load a GIF in CF? If so, how?



    TIA and Regards,
    Edwin

    Wednesday, July 26, 2006 10:06 AM

Answers

  • It is possible to load GIF if your device includes appropriate GIF decoder. It appears your device does not.

     

    Please consider using some other supported format, e.g. JPEG. GIF is a poor choice anyway as it's usually indexed 256 color format which looks terrible on 16 bit direct color screens found in most devices.

    Wednesday, July 26, 2006 4:02 PM

All replies

  • It is possible to load GIF if your device includes appropriate GIF decoder. It appears your device does not.

     

    Please consider using some other supported format, e.g. JPEG. GIF is a poor choice anyway as it's usually indexed 256 color format which looks terrible on 16 bit direct color screens found in most devices.

    Wednesday, July 26, 2006 4:02 PM
  • Thanks for the advice Ilya. What formats (compressed) are supported without the need for a seperate decoder? Basically my concern is the resulting file size as an uncompressed BMP file is quite huge.



    Thanks and Regards,
    Edwin

    Thursday, July 27, 2006 1:35 AM