1

I have a Stream with an bit image content and I create image from the stream using followed code.

byte[] bits = page.EnhMetaFileBits;

using (var ms = new MemoryStream((byte[])(bits)))
{
    using (var imageFromStream = Image.FromStream(ms))
    {
      //....
    }
}

The code works properly but when it is run on Windows 10 Professional I receive a big image whats about 5000 x 7000 pixels with 600 dpi resolution. However, on Windows Server 2012R2 I obtain a tiny image 800 x 1100 pixels with 80 dpi and it is too small for my aims.

The size of the bytes array is almost the same, the versions of the System. Imaging is equal.

I suspect that it is related to an operating system setting, but I don't know which one.

TylerH
  • 20,799
  • 66
  • 75
  • 101
Ter Ser
  • 19
  • 2
  • 4
    Perhaps this would help? https://stackoverflow.com/questions/26834715/different-scaling-when-drawing-metafile-on-different-machines – Leandro Nov 02 '21 at 19:58
  • 1
    I hate to tell you, but "The size of the bytes array is almost the same, " is an indication it is NOT the same image. Period. Same image, EXACTLY same byte sequence. So, why are you getting a different image? THIS is what you nee dto find out - not your code. You bark the wrong tree. Where is the image coming from, and why is it different? – TomTom Nov 03 '21 at 13:48

1 Answers1

0

The problem was resolved by increasing display resolution on Windows Server 2012R2 PC. Thank you everyone!

Ter Ser
  • 19
  • 2