Image Compression Level #1368
Replies: 1 comment
-
It worked when I wrote to the new stream. public Stream Compress(Stream stream, int compressionRatio)
{
using var image = new MagickImage(stream);
image.Quality = 100 - compressionRatio;
stream.Position = 0;
image.Write(stream);
return stream;
} New Code: public Stream Compress(Stream stream, int compressionRatio)
{
using var image = new MagickImage(stream);
image.Quality = 100 - compressionRatio;
Stream newStream = new MemoryStream();
image.Write(newStream);
return newStream;
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I want to perform Image Compression according to the compression ratio I have determined, how can I do it?
Beta Was this translation helpful? Give feedback.
All reactions