I am resizing images using Image Resizer. Everything's working as expected except one of our clients posted transparent jpeg, and resizing that image to 64*64 dimensions generates an image with black background. However, it works fine if the dimensions are larger like 1024.

    var instructions = new Instructions
            Height = 64,
            Mode = FitMode.Max,
            OutputFormat = "jpeg",
            Width = 64

    var job = new ImageJob(inputStream, outputStream, instructions);

    job.DisposeSourceObject = false;

    job.InstructionsAsString += "&fastscale=true";


1 Answers

DotNet Coder On

"fastscale=true" was creating a problem in my case. So for all heights and widths that are greater than 75, it works as expected.

So I added following check to not include it for small dimensions

if (height >= 75 && width>= 75) {

job.InstructionsAsString += "&fastscale=true";