ImageCodecs.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //
  2. // Sample application for encoder/decoder
  3. //
  4. // Author:
  5. // Jordi Mas i Hernàndez, [email protected]
  6. //
  7. using System;
  8. using System.Drawing;
  9. using System.Drawing.Drawing2D;
  10. using System.Drawing.Imaging;
  11. //
  12. public class SampleImageCodecs
  13. {
  14. public static void DumpCodeInfo (ImageCodecInfo codec)
  15. {
  16. Console.WriteLine ("Clsid:" + codec.Clsid);
  17. Console.WriteLine ("FormatID:" + codec.FormatID);
  18. Console.WriteLine ("Codec:" + codec.CodecName);
  19. Console.WriteLine ("DllName:" + codec.DllName);
  20. Console.WriteLine ("Extension:" + codec.FilenameExtension);
  21. Console.WriteLine ("Format:" + codec.FormatDescription);
  22. Console.WriteLine ("MimeType:" + codec.MimeType);
  23. Console.WriteLine ("Flags:" + codec.Flags);
  24. Console.WriteLine ("Version:" + codec.Version);
  25. }
  26. public static void Main(string[] args)
  27. {
  28. ImageCodecInfo[] decoders = ImageCodecInfo.GetImageDecoders();
  29. ImageCodecInfo[] encoders = ImageCodecInfo.GetImageEncoders();
  30. Console.WriteLine ("Encoders ********");
  31. for (int i = 0; i < encoders.Length; i++) {
  32. DumpCodeInfo (encoders[i]);
  33. Console.WriteLine ("---");
  34. }
  35. Console.WriteLine ("Decoders ********");
  36. for (int i = 0; i < decoders.Length; i++) {
  37. DumpCodeInfo (decoders[i]);
  38. Console.WriteLine ("---");
  39. }
  40. }
  41. }