M
Mads Aggerholm
Hello Sirs,
I am having a BMP loadet into a picturebox. This I'd like to save on
my harddisk as a GIF:
picturebox1.Image.Save("C:\\DATA\\PICTURES\\testpic.gif",
ImageFormat.Gif);
However, this GIF-file is not in very good quality.
Using "Irfanview", I can change a BMP-file to GIF in quite better
quality setting an option called "save interlaced".
How am I going to do that using C#?
I have allready tried:
EncoderParameters encparams = new
EncoderParameters(1);
encparams.Param[0] = new
EncoderParameter(System.Drawing.Imaging.Encoder.ColorDepth, 256L);
ImageCodecInfo[] imcodecinfo =
ImageCodecInfo.GetImageEncoders();
picturebox1.Image.Save(("C:\\DATA\\PICTURES\
\testpic.gif", imcodecinfo[0], encparams);
and more of the kind: Encoder.Compression, Encoder.Quality, etc.
This actually solves the problem, no matter what value I put after the
Encoder."something": (16L, 32L, 256L - why the "L" by the way??)
The only problem here is, that this GIF-file i about 7 times as big as
nessasary.
The GIF file saved with the "ImageFormat.Gif" is 24 Kb.
The GIF made with Irfanview interlaced is 56 Kb (and this has the
quality I need).
Using these EncoderParameters, the GIF ends up being 359 Kb.
This is a problem! By different reasons it is important that the files
are as small as possible, and I have to use GIF.
The fact that Irfanview can do this, tells me it can be done.
Can anybody in here tell me how?
Thank you very much in advance.
Sincerely / Best regards
Mads Aggerholm
I am having a BMP loadet into a picturebox. This I'd like to save on
my harddisk as a GIF:
picturebox1.Image.Save("C:\\DATA\\PICTURES\\testpic.gif",
ImageFormat.Gif);
However, this GIF-file is not in very good quality.
Using "Irfanview", I can change a BMP-file to GIF in quite better
quality setting an option called "save interlaced".
How am I going to do that using C#?
I have allready tried:
EncoderParameters encparams = new
EncoderParameters(1);
encparams.Param[0] = new
EncoderParameter(System.Drawing.Imaging.Encoder.ColorDepth, 256L);
ImageCodecInfo[] imcodecinfo =
ImageCodecInfo.GetImageEncoders();
picturebox1.Image.Save(("C:\\DATA\\PICTURES\
\testpic.gif", imcodecinfo[0], encparams);
and more of the kind: Encoder.Compression, Encoder.Quality, etc.
This actually solves the problem, no matter what value I put after the
Encoder."something": (16L, 32L, 256L - why the "L" by the way??)
The only problem here is, that this GIF-file i about 7 times as big as
nessasary.
The GIF file saved with the "ImageFormat.Gif" is 24 Kb.
The GIF made with Irfanview interlaced is 56 Kb (and this has the
quality I need).
Using these EncoderParameters, the GIF ends up being 359 Kb.
This is a problem! By different reasons it is important that the files
are as small as possible, and I have to use GIF.
The fact that Irfanview can do this, tells me it can be done.
Can anybody in here tell me how?
Thank you very much in advance.
Sincerely / Best regards
Mads Aggerholm