This project has moved and is read-only. For the latest updates, please go here.

Is there any way to update all pixels at once using a byte array?

Nov 19, 2013 at 9:01 PM
Is there any way to update all pixels at once using a byte array?
private void ApplyEffect(string parameter)
{
    try
    {
        int width = this.imageSource.PixelWidth;
        int height = this.imageSource.PixelHeight;

        byte[] pixels = this.magickImage.ToByteArray();
        IntPtr result = EffectsWrapper.ApplyEffect(parameter, pixels, width, height);
        if (result != IntPtr.Zero)
        {
            byte[] resultPixels = new byte[pixels.Length];
            Marshal.Copy(result, resultPixels, 0, pixels.Length);
            // I'm looking for something similar to this:
            // this.magickImage.SetPixels(resultPixels);
        }
    }
    catch (Exception exception)
    {
        MessageBox.Show(exception.Message);
    }
}
Nov 19, 2013 at 10:34 PM
You can access the pixels of the image with the GetWritablePixels method of MagickImage. At this moment there is only a Set method that accepts a float array. Might be a good idea to also add a method that accepts a byte array.
Nov 20, 2013 at 5:52 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.