为什么我保存的 ARGB 组件与我从保存的文件中检索的组件不同?

Why there is a difference between the ARGB component I'm saving and the one I'm retrieving from the saved file?

[Offtopic] 如果我不够准确,请原谅,这是我的第一个问题,我也是编程新手。

[问题] 我想使用 Bitmap.SetPixel 将位图(照片,jpg 文件)的单个像素的 ARGB 分量更改为精确值,并使用 [=22] 将其保存到新文件=].不幸的是它没有用。当我重新打开文件时,我想要更改的像素 (0, 0) 的 ARGB 值略有不同。为什么会这样?是否可以创建一个文件,该文件完全具有我想要的特定像素的 ARGB 组件?

这是我的代码:

Bitmap originalMap = new Bitmap("image.jpg");

Color current = originalMap.GetPixel(0, 0);
//This one shows the original ARGB values
Console.WriteLine(current);

originalMap.SetPixel(0, 0, Color.FromArgb(255, 100, 100, 100));
originalMap.Save("new.jpg");
//This one shows the result that I want, but the bitmap is not re-opened
Console.WriteLine(originalMap.GetPixel(0, 0));

Bitmap openTheNewFile = new Bitmap("new.jpg");
//The actual result after I open the saved file, A=255, R=108, G=113, B=117
Console.WriteLine(openTheNewFile.GetPixel(0, 0));

为什么是 108、113 和 117 而不是 100、100、100?

预先感谢您的回答,我很确定这是基本的(至少可以说),但它确实困扰着我。

JPEG 使用有损压缩算法。如果您在原始图像中设置单个像素,则压缩图像中的相应像素很可能不再具有完全相同的颜色值。

要保留准确的颜色值,请使用无损压缩格式(例如 PNG)或使用未压缩的位图。