I'd recommend a minor tweak to your code to remove the 'magic' string of the mimeType from the code, using the following:
static void Main(string[] args)
{
Bitmap bitMap = new Bitmap(@"test.bmp");
var codecInfo = GetEncoderInfo(ImageFormat.Gif);
var paramsEncoder = new EncoderParameters(2);
paramsEncoder.Param[0] = new EncoderParameter(Encoder.Compression, (long)EncoderValue.CompressionLZW);
paramsEncoder.Param[1] = new EncoderParameter(Encoder.Quality, 0L);
bitMap.Save("Output.gif", codecInfo, paramsEncoder);
}
private static ImageCodecInfo GetEncoderInfo(ImageFormat format)
{
return ImageCodecInfo.GetImageEncoders().FirstOrDefault(x => x.FormatID == format.Guid);
}
Since I've begun my profession as a software developer, I've learned one important fact - change is inevitable. Requirements change, code changes, and life changes.
So..If you're not moving forward, you're moving backwards.