mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Avoid checking pixels if it is not 32 bpp already
This commit is contained in:
parent
94233bbe33
commit
2caec59a52
1 changed files with 7 additions and 2 deletions
|
@ -676,10 +676,15 @@ public static bool IsImagesEqual(Bitmap bmp1, Bitmap bmp2)
|
|||
|
||||
public static bool IsImageTransparent(Bitmap bmp)
|
||||
{
|
||||
using (UnsafeBitmap unsafeBitmap = new UnsafeBitmap(bmp, true, ImageLockMode.ReadOnly))
|
||||
if (bmp != null && bmp.PixelFormat == PixelFormat.Format32bppArgb)
|
||||
{
|
||||
return unsafeBitmap.IsTransparent();
|
||||
using (UnsafeBitmap unsafeBitmap = new UnsafeBitmap(bmp, true, ImageLockMode.ReadOnly))
|
||||
{
|
||||
return unsafeBitmap.IsTransparent();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool AddMetadata(Image img, int id, string text)
|
||||
|
|
Loading…
Reference in a new issue