0

I am trying to resize an image using Magick.NET, but after I call the Resize function the FileSize property reads 0. What am I doing wrong?

var image = new MagickImage(file.InputStream);
fileSize = image.FileSize; //will read something > 0
image.Resize(80, 80);
// image.FileSize will read 0
image.Write(stream); // results in a 0 byte stream
dlemstra
  • 7,813
  • 2
  • 27
  • 43
Matt Baker
  • 3,394
  • 3
  • 25
  • 35

1 Answers1

1

It looks like I was (mostly) wrong about the effects of FileSize reading 0 after calling Resize. It does read 0, but calling Write doesn't actually write nothing, it does populate the output stream as expected. The real problem in my case came from code that followed this that consumed the contents of stream without resetting its Location back to 0.

Matt Baker
  • 3,394
  • 3
  • 25
  • 35