Search code examples
imageprocessor

Does ImageProcessor ImageFactory Load System.Drawing.Image modify by reference argument


ImageProcessor ImageFactory supports Load method with argument System.Drawing.Image. But Save method does not support similar argument. Is there a way with ImageProcessor ImageFactory to Load a System.Drawing.Image, manipulate the image, e.g., Brightness, then Save the modified image to System.Drawing.Image?


Solution

  • You can't use a reference to the original image since that is tightly bound to the input stream.

    You can either. 1. Save to the output stream and use Image.FromStream to create a new image. 2. Use a binary formatter to perform a deep clone of the ImageFactory.Image property https://stackoverflow.com/a/43042865/427899