I cannot explain why your second example is not working. I made a fix in ImageMagick to print a better error message. You should try again after the next release that will be published this week.
You can also rewrite your first example. MagickImage contains a method called ToBase64 and you should set the Density before loading your image:
You can also rewrite your first example. MagickImage contains a method called ToBase64 and you should set the Density before loading your image:
MagickReadSettings settings = new MagickReadSettings(); settings.Density = new MagickGeometry(400, 400); using(MagickImage image = new MagickImage(file.InputStream, settings) { image.Format = MagickFormat.Jpeg; imgString = image.ToBase64(); }