Open ankitbko opened 2 years ago
Hmm, I wasn't able to replicate this behavior with a simple test. I saved your second image as "C:\Temp\test-image.png", loaded it as a \psi Image
, and called ToBitmap
in both ways.
var image = Image.FromBitmap(new Bitmap(@"C:\Temp\test-image.png"));
image.ToBitmap(false).Save(@"C:\Temp\test-image-false.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
image.ToBitmap(true).Save(@"C:\Temp\test-image-true.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
but both resulting images look fine...
There still might be a bug in ToBitmap
if something is screwed up with stride or pixel format, but I think I would have to see more of your code showing how the Shared<Image>
stream gets created that is being passed to your Receive
method.
After troubleshooting together, we found out that the incorrect behavior happens in linux only and not in windows (mac is untested). The sample code that @sandrist wrote leads to reproducible behavior in linux machine.
When
var bmp = message.Data.Resource.ToBitmap(false);
I get this imageWhen I change the Boolean
using var bmp = message.Data.Resource.ToBitmap(true);
I get this image.Not sure if this is a bug or not.