locked
Save Base64 Image with 300 dpi RRS feed

  • Question

  • User1536465747 posted

    Hello,

    I have an image converted to Base64 (unfortunately I can't change anything about it) and now I need to save it with 300dpi resolution/quality

    var decodedImage = Convert.FromBase64String(encodedImage);
    // save the image to the file system
    File.WriteAllBytes("filename.png", decodedImage);

    Obviously the code above doesn't do that as WriteAllBytes has no parameter/overload for resolution so the image is saved with 72dpi 

    Any advice/help is welcomed. Thank you so much

    Thursday, July 11, 2019 6:48 AM

All replies

  • User753101303 posted

    Hi,

    You would need to go through the Bitmap class to use https://docs.microsoft.com/en-us/dotnet/api/system.drawing.bitmap.setresolution?view=netframework-4.8 or maybe to update directly the file header if you know about the format.

    You are sure that changing the DPI without anything else would solve your issue ?

    Edit: according to https://www.file-recovery.com/jpg-signature-format.htm it might be always at the same offset starting at byte 143 if I counted correctly. Are both this one and the next at 72 already ?

    You could perhaps have a method that checks to see if it can be changed directly and if the format is not supported yet that fallback to using the Bitmap class ?

    Ah ! For some reason I read jpg rather than png but the basic idea is unchanged. It should be quite easy to find the format and change this information directly.

    Thursday, July 11, 2019 8:24 AM
  • User839733648 posted

    Hi KulerMaster,

    As PatriceSc has mentioned,you could use Bitmap constructor to achieve your requirement.

    You could use SetResolution method to change the resolution of your image.

    Here is a sample code and hope it will be helpful to you.

                var encodedImage = "iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAABGdBTUEAAK/INwWK6QAANGFJREFUeNpi/P//P8MoGLkAIICYRoNgZAOAABpNACMcAATQaAIY4QAggEYTwAgHAAE0mgBGOAAIoNEEMMIBQACNJoARDgACaDQBjHAAEECjCWCEA4AAGk0AIxwABBADaCgYGQ8BoA/E+4GYfzT2KI9vgAAaagkAFPnvQf4A4vOjiYDyBAAQQIzokc7IyDhY3S4PxBeAWABJDMR3AOKPhDTfrAMnHmS9DmhKDiCxP6g3MVykMKEaAPHCwZgAkAFAAA2lBAAC8UC8AEvEOSJFtD008EFYAUoLkGnfB2giewClLwATxkECevKBeAKUD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6FXRySELhkoG0Hdgbst0VhSySM7NCI58RIAD+e/2b4+eIHEH8DRvo7IP2BVKeCGncLqNmypyQBAATQoEkASAlBHpoIEhgovLwCpdQAJQrQSl/QKSZiDPA5Y055pIQApX9/YGb48wGyFu/vDyZgJP8F5ux/4IgnE1yANoBBuf3hQIYvenwDBNCgSwA4EgMIOzAMLXAAmtsHPNLxJQCAABrUCQBLe8EBCRsMMidegEY6GNOzXqckAQAE0JBJAHjGFgygWIFOpcQHaGQ/gNIXaNVnp0cCAAigIZ0ACCQMBrQEQWriOIDOHkoRTWwCAAggRlzz2qNgZACAAGIaDYKRDQACaDQBjHAAEECjCWCEA4AAGk0AIxwABNBoAhjhACCARhPACAcAATSaAEY4AAgwADWU/k3/rNBBAAAAAElFTkSuQmCC";
                var decodedImage = Convert.FromBase64String(encodedImage);
                System.Drawing.Image image;
                using (MemoryStream ms = new MemoryStream(decodedImage))
                {
                    image = System.Drawing.Image.FromStream(ms);
                }
                Bitmap bitmap = new Bitmap(image, new Size(320, 960));
    bitmap.SetResolution(200, 400); bitmap.Save(@"D:\test.png", System.Drawing.Imaging.ImageFormat.Png);

    For more, you could refer to the following links:

    Change the resolution of PNG image and save it

    converting a base 64 string to an image and saving it

    Best Regards,

    Jenifer

    Friday, July 12, 2019 4:12 AM