I don’t understand a bit why this code does not work:
using (var ms = new MemoryStream()) { using (FileStream fs = new FileStream(file, FileMode.Open)) { fs.CopyTo(ms); } using (var bmp = (Bitmap)Image.FromStream(ms)) { bmp.SetResolution(300, 300); bmp.Save(@"E:\Projects\My Projects\ChangeDPI\test.png"); } } That is, at the DPI output, the image remains unchanged.
If you create a new Bitmap from bmp, then everything is saved successfully.
Is this some kind of library special, or am I doing something wrong?