本文介紹了如何檢查圖片是否為灰度的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
可能的重復:
如何查看位圖的顏色深度?
我正在接收圖片的路徑.我需要知道那張圖片是否是灰度的.我該怎么做?
I'm receiving the path of a picture. I would need to know if that picture is in grayScale. How can I do this?
我正在嘗試使用此代碼將該路徑加載到位圖,但它一直提示我該參數無效.
I'm trying to load that path to a Bitmap using this code, but it keeps saying me that the parameter is not valid.
Bitmap myBitmap = new Bitmap(pFilePath);
我可以從 ByteArray 中檢查它是否是灰度的嗎?或者有什么方法可以從位圖做到這一點?那會怎樣?
Can I check if it is in grayScale from a ByteArray? Or is there some way to do it from a Bitmap? How would that be?
謝謝.
推薦答案
檢查這個 財產
image.PixelFormat
它將匹配 系統中的值之一.繪圖.成像.像素格式
這篇關于如何檢查圖片是否為灰度的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!