Hi, i load a .hdr image in a MagickImage and then change the value of a pixel to {0,0,0} (the image has 3 channels. What happens is that after the first pixelCol.Set(x,y, black) everything becomes (0,0,0). I can't understand why. The sample code is reported here:
```
void mymethod(ref MagickImage image, double[][] pixelSet, float[] black)
PixelCollection ps = image.GetPixels();
Pixel p;
foreach (double[] pixel in pixelSet)
{
if (mycondition)
{
p = ps.GetPixel((int)pixel[X_COMP], (int)pixel[Y_COMP]);
Console.WriteLine("Before: " +p.ToColor().R + " " + p.ToColor().G + " " + p.ToColor().B);
ps.Set((int)pixel[X_COMP], (int)pixel[Y_COMP], black);
p = ps.GetPixel((int)pixel[X_COMP], (int)pixel[Y_COMP]);
Console.WriteLine("After: " +p.ToColor().R + " " + p.ToColor().G + " " + p.ToColor().B);
}
}
```
The code returns
> Before: regularfloat regularfloat regularfloat
After: zero zero zero
For the first iteration, and
> Before: zero zero zero
After: zero zero zero
For all the others iterations. I tried skipping the first iteration and the result is the same but starting from the second iteration.
Comments: Are you sure that the values of pixelSet are correct. I cannot reproduce your issue with the following code: ```C# using (MagickImage image = new MagickImage("logo:")) { using (PixelCollection ps = image.GetPixels()) { float[] black = new float[] { 0, 0, 0 }; Pixel p = ps.GetPixel(0, 0); Console.WriteLine("Before: " + p.ToColor().R + " " + p.ToColor().G + " " + p.ToColor().B); ps.Set(0, 0, black); p = ps.GetPixel(0, 0); Console.WriteLine("After: " + p.ToColor().R + " " + p.ToColor().G + " " + p.ToColor().B); p = ps.GetPixel(1, 1); Console.WriteLine("Other: " + p.ToColor().R + " " + p.ToColor().G + " " + p.ToColor().B); } } ```
```
void mymethod(ref MagickImage image, double[][] pixelSet, float[] black)
PixelCollection ps = image.GetPixels();
Pixel p;
foreach (double[] pixel in pixelSet)
{
if (mycondition)
{
p = ps.GetPixel((int)pixel[X_COMP], (int)pixel[Y_COMP]);
Console.WriteLine("Before: " +p.ToColor().R + " " + p.ToColor().G + " " + p.ToColor().B);
ps.Set((int)pixel[X_COMP], (int)pixel[Y_COMP], black);
p = ps.GetPixel((int)pixel[X_COMP], (int)pixel[Y_COMP]);
Console.WriteLine("After: " +p.ToColor().R + " " + p.ToColor().G + " " + p.ToColor().B);
}
}
```
The code returns
> Before: regularfloat regularfloat regularfloat
After: zero zero zero
For the first iteration, and
> Before: zero zero zero
After: zero zero zero
For all the others iterations. I tried skipping the first iteration and the result is the same but starting from the second iteration.
Comments: Are you sure that the values of pixelSet are correct. I cannot reproduce your issue with the following code: ```C# using (MagickImage image = new MagickImage("logo:")) { using (PixelCollection ps = image.GetPixels()) { float[] black = new float[] { 0, 0, 0 }; Pixel p = ps.GetPixel(0, 0); Console.WriteLine("Before: " + p.ToColor().R + " " + p.ToColor().G + " " + p.ToColor().B); ps.Set(0, 0, black); p = ps.GetPixel(0, 0); Console.WriteLine("After: " + p.ToColor().R + " " + p.ToColor().G + " " + p.ToColor().B); p = ps.GetPixel(1, 1); Console.WriteLine("Other: " + p.ToColor().R + " " + p.ToColor().G + " " + p.ToColor().B); } } ```