Closed NiJeTi closed 3 years ago
Lossless formats take up much more space than lossy formats. You might try the lossy webp encoder and set an equivalent quality value to what the jpeg was created with.
On Sat, Jul 31, 2021, 3:22 PM Arkady Skvoretsky @.***> wrote:
Using library to reduce incoming images size.
Used code:
public async Task
ConvertStreamAsync(Stream input, CancellationToken cancellationToken) { Log.Debug("Converting image stream"); using var imagesProcessor = new ImageJob(); var output = new MemoryStream(); await imagesProcessor .Decode(input, false) .EncodeToStream(output, false, new WebPLosslessEncoder()) .Finish() .WithCancellationToken(cancellationToken) .InProcessAsync(); output.Position = 0; Log.Debug("Done converting image stream"); return output;
}
input stream can contain JPEG, PNG, WebP and GIF
After passing 1.1 MB JPEG to input I received 4,82 MB WebP [image: image] https://user-images.githubusercontent.com/5685857/127752686-8bab1d0b-c107-43a3-b4ee-6dffbad07471.png
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/imazen/imageflow-dotnet/issues/38, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2LH2RV44BUCWV4PAL5TLT2RSP3ANCNFSM5BKMP3XA .
Thanks for the explanation!
Using library to reduce incoming images size.
Used code:
input
stream can contain JPEG, PNG, WebP and GIFAfter passing 1.1 MB JPEG to input I received 4,82 MB WebP