Wrong RGB values in GetPixel() from png image
<p>This is the problem:<br>
I save a Bitmap in <code>.png</code>  with colors say <code>ARGB(50,210,102,70)</code> with dimension <code>1 x 1 pixel</code>.</p>
<p>I retrieve the same image again and use the <code>GetPixel(0,0)</code> method, what I get is <code>ARGB(50,209,102,70)</code>.</p>
<p>There is a slight variation in the retrieved value, the <code>RGB</code> values slightly differ but the <code>A</code> value remains same.</p>
<p>However when i use <code>255</code> for <code>A</code> value, the correct <code>RGB</code> values are returned.</p>
<p>So,.. Using a value less than <code>255</code> for <code>A</code> results in the problem mentioned above.</p>
<p>Here is the code which saves the Bitmap.</p>
<pre><code>Bitmap bmpPut = new Bitmap(1, 1); //Also tried with 'PixelFormat.Format32bppArgb'
bmpPut.SetPixel(0, 0, Color.FromArgb(254, 220, 210, 70)); 
bmpPut.Save(&quot;1.png&quot;); //Also tried with using 'ImageFormat.Png'
</code></pre>
<p>Here is the code which gets the pixel color</p>
<pre><code>Bitmap bit = new Bitmap(Image.FromFile(&quot;1.png&quot;));
MessageBox.Show(&quot;R:&quot; + bit.GetPixel(0, 0).R.ToString() +
    &quot;| G: &quot; + bit.GetPixel(0, 0).G.ToString() +
    &quot;| B: &quot; + bit.GetPixel(0, 0).B.ToString() +
    &quot;| A: &quot; + bit.GetPixel(0, 0).A.ToString());
</code></pre>
<p>What i get is <code>ARGB(254,219,209,70)</code></p>
<p><a href="https://i.stack.imgur.com/SdSFi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SdSFi.png" alt="enter image description here" /></a></p>
<p><strong>P.S.</strong>: I read a few similar questions, they were'nt addressing this exact issue and I din't find a solution yet.</p>