Skip to content

Set default resize image quality #138

Answered by JimBobSquarePants
sophisma asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @sophisma

Thanks! It's really great to hear you like it!

Yep you can do this at startup when registering the services.

First create the following method. That will build you a custom configuration instance using a default quality of 91.

internal static Configuration CreateCustomConfiguration()
{
    var configuration = new Configuration(
        new PngConfigurationModule(),
        new GifConfigurationModule(),
        new BmpConfigurationModule(),
        new TgaConfigurationModule());

    // 91 is the minimum quality required to force the encoder to not use
    // 4:2:0 subsampling.
    var jpegEncoder = new JpegEncoder { Quality = 91 };
    configuration.ImageFormatsManager.SetEnc…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@sophisma
Comment options

@JimBobSquarePants
Comment options

Answer selected by sophisma
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants