Replies: 3 comments 1 reply
-
Without any code from you there’s no way to tell what you are doing or how to help you |
Beta Was this translation helpful? Give feedback.
-
This code does a couple of unnecessary operations on every value change:
I'm sure this can be all avoided, but I'm not familiar enough with WPF to give specific advice how to do it. I can recommend this project implementing a WPF ImageSource on top of ImageSharp: Ideally, it should be even possible to do a zero-copy interop with |
Beta Was this translation helpful? Give feedback.
-
Dear @antonfirsov, I tried this and it did work well. But I am not that deep into ImageSharp or WPF, so I do not know wether there may be problems with this approach. I compared this with the mentioned "SharpImageSource" with a simple test and it seems to be at about 3 times faster. Would like to get a comment on wether I am heading into the right direction here. [TestMethod] public void BitmapSource_WrapMemory()
{
Int32 width = 100;
Int32 height = 100;
Int32 bits = 32;
Int32 stride = (width * bits + 7) / 8;
Int32 bytes = stride * height;
Byte[]? pixels = new Byte[bytes];
var source = BitmapSource.Create(
pixelWidth: width,
pixelHeight: height,
dpiX: 96,
dpiY: 96,
pixelFormat: PixelFormats.Bgra32,
palette: null,
pixels: pixels,
stride: stride);
var image = Image.WrapMemory<Argb32>(
byteMemory: pixels,
width: width,
height: height);
GraphicsOptions? options = GetOptions();
image.Mutate(x => x.Fill(options, Color.AliceBlue));
String? path = Helper.GetPath("BitmapSource_WrapMemory", "bmp");
image.SaveAsBmp(path);
} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Can you help me pls... How to implement the brightness change via the slider? Opening a file via a stream, changing its brightness via Mutate, opening a MemoryStream and saving an image to it with subsequent output to Image control is sooo slow. How to implement it correctly?
Its UWP
Beta Was this translation helpful? Give feedback.
All reactions