mirror of https://github.com/SixLabors/ImageSharp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.1 KiB
35 lines
1.1 KiB
using System;
|
|
using ImageSharp;
|
|
|
|
namespace ChangeDefaultEncoderOptions
|
|
{
|
|
class Program
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
// lets switch out the default encoder for jpeg to one
|
|
// that saves at 90 quality and ignores the matadata
|
|
Configuration.Default.SetMimeTypeEncoder("image/jpeg", new ImageSharp.Formats.JpegEncoder()
|
|
{
|
|
Quality = 90,
|
|
IgnoreMetadata = true
|
|
});
|
|
|
|
// now lets say we don't want animated gifs, lets skip decoding the alternative frames
|
|
Configuration.Default.SetMimeTypeDecoder("image/gif", new ImageSharp.Formats.GifDecoder()
|
|
{
|
|
IgnoreFrames = true,
|
|
IgnoreMetadata = true
|
|
});
|
|
|
|
// and just to be douple sure we don't want animations lets disable them on encode too.
|
|
Configuration.Default.SetMimeTypeEncoder("image/gif", new ImageSharp.Formats.GifEncoder()
|
|
{
|
|
IgnoreFrames = true,
|
|
IgnoreMetadata = true
|
|
});
|
|
|
|
|
|
}
|
|
}
|
|
}
|