Compress Image
See original GitHub issuePrerequisites
- I have written a descriptive issue title
- I have verified that I am using the latest version of Magick.NET
Question
I just install Magick.net from nuget and I have a problem when I want to compress and resize image from IFormFile (Net Core 2.1)
Here my sample code
var stream = file.OpenReadStream(); using (MemoryStream ms = new MemoryStream()) { stream.CopyTo(ms); ImageOptimizer optimizer = new ImageOptimizer(); optimizer.LosslessCompress(ms); //error here: Value cannot be empty - Params: Stream }
If I load file from physical path, it’s working fine, but I need compress and resize before upload image. Please help me!!!
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Easily compress images at optimal quality in seconds.
Choose multiple JPG, PNG or GIF images and compress them in seconds for free! You can shrink with ease in just a few...
Read more >Online Image Сompressor
Our tool uses lossy compression to shrink down image files. It supports three file types: PNG, JPG/JPEG, and GIF. This system intelligently analyzes...
Read more >TinyPNG – Compress WebP, PNG and JPEG images ...
TinyPNG optimizes your WebP, PNG and JPEG images by 50-80% while preserving full transparency! ... Compress all your images automatically! WordPress plugin.
Read more >Image Compressor - Compress Images Online in High ...
Compress image files while preserving quality. Easily reduce image size by up to 80% with lossy compressions using this free tool.
Read more >Compress image - Reduce image file size online
Free online image compression. Make image files smaller to send them via e-mail or whatsapp or upload them to the internet.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You need to set the
Position
of the memory stream back to0
before you pass it to theLosslessCompress
method. I will see if I can give a better error message when this happens.@dlemstra agreed. thanks for your reply.