給自己備註的 如果使用的是條碼印表機列印圖像,由於條碼印表機沒有所謂顏色深淺的特性 其不是黑(Black)就是白(non-Black),如果要列印圖像(像是標籤上的LOGO), 圖片若是彩色的情況就會出現像是毛邊的點。 解決的方式就是要將圖片做灰階的二階化(threshold) 下面這個方法可以先產生一個二階化圖像的ImageAttributes: static ImageAttributes BWThreshold(Image sourceImage, float ThresholdLevel) { var gray_matrix = new float[][] { new float[] { 0.299f, 0.299f, 0.299f, 0, 0 }, new float[] { 0.587f, 0.587f, 0.587f, 0, 0 }, new float[] { 0.114f, 0.114f, 0.114f, 0, 0 }, new float[] { 0, 0, 0, 1, 0 }, new float[] { 0, 0, 0, 0, 1 } }; var ia = new System.Drawing.Imaging.ImageAttributes(); using (Graphics gr = Graphics.FromImage(sourceImage)) { ia.SetColorMatrix(new System.Drawing.Imaging.ColorMatrix(gray_matrix)); ia.SetThreshold(ThresholdLevel); // Change this threshold as needed }