question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prerequisites

  • 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:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dlemstracommented, Sep 24, 2018

You need to set the Position of the memory stream back to 0 before you pass it to the LosslessCompress method. I will see if I can give a better error message when this happens.

0reactions
franvacommented, May 3, 2019

@dlemstra agreed. thanks for your reply.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found