using System.Drawing.Imaging;
public static void Main()
var t = typeof(ImageCodecInfo);
var m = t.GetMethod("GetImageEncoders", BindingFlags.Public | BindingFlags.Static);
var c = m.Invoke(null, Array.Empty<object>()) as Array;
var f1 = t.GetProperty("CodecName");
var f2 = t.GetProperty("FormatID");
for (var i = 0; i < c.Length; i++)
if (Object.Equals(f2.GetValue(codec), ImageFormat.Jpeg.Guid))
var t2 = typeof(EncoderParameters);
var e = Activator.CreateInstance(t2, new object[] { 1 });
var f3 = t2.GetProperty("Param");
var t3 = typeof(EncoderParameter);
var e1 = Activator.CreateInstance(t3, new object[] { codec, 30L });
f3.SetValue(e, e1, new object[] { 0 });