Why does RenderOptions.BitmapScalingMode affect a line appearing in my WPF bitmapImage?

87 Views Asked by At

I have a wpf application that displays a bitmapImage in an image control that is inside a viewbox. I use binding to set the image to a bitmapImage object that I create within the code. After creating the bitmapimage, I call OnPropertyChanged to get the image to update. For some reason, when rendered, a line appears through the colored part of my image. I also save the image to disk and it looks fine with no line, so it seems that I am drawing it correctly. I notice the line is affected when I play with RenderOptions.BitmapScalingMode. The line barely appears in high quality so it seems to improve things but I can still barely see the line though (see links to pics below). I am wondering if anyone knows any other settings I should look at?

Note: also tried Also tried SnapsToDevicePixels="True" on the viewbox and UseLayoutRounding="True"

Low Quality

High quality

Exported Image

Tried setting: RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.SoftwareOnly;

Tried RenderOptions.SetEdgeMode(m_detectedSampleImage, EdgeMode.Aliased). No luck

UPDATE: Looking at the exported image in the web browser, I do see the line. But when looking at the exported image in ImageJ, I do NOT see the line!

1

There are 1 best solutions below

0
AlThurm On

Looking at the image in the browser it appears the line is there. Seems ImageJ did a good job of hiding it which is weird because ImageJ displays it bigger by default. Anyway, back to the beginning to make sure I'm drawing the bitmap correctly