diff --git a/SDWebImage/Core/NSData+ImageContentType.h b/SDWebImage/Core/NSData+ImageContentType.h index 5bbb4ae6..8c2f97e8 100644 --- a/SDWebImage/Core/NSData+ImageContentType.h +++ b/SDWebImage/Core/NSData+ImageContentType.h @@ -23,6 +23,8 @@ static const SDImageFormat SDImageFormatTIFF = 3; static const SDImageFormat SDImageFormatWebP = 4; static const SDImageFormat SDImageFormatHEIC = 5; static const SDImageFormat SDImageFormatHEIF = 6; +static const SDImageFormat SDImageFormatPDF = 7; +static const SDImageFormat SDImageFormatSVG = 8; /** NSData category about the image content type and UTI. diff --git a/SDWebImage/Core/NSData+ImageContentType.m b/SDWebImage/Core/NSData+ImageContentType.m index 34dd4aa0..b3b8e22b 100644 --- a/SDWebImage/Core/NSData+ImageContentType.m +++ b/SDWebImage/Core/NSData+ImageContentType.m @@ -93,6 +93,12 @@ case SDImageFormatHEIF: UTType = kSDUTTypeHEIF; break; + case SDImageFormatPDF: + UTType = kUTTypePDF; + break; + case SDImageFormatSVG: + UTType = kUTTypeScalableVectorGraphics; + break; default: // default is kUTTypePNG UTType = kUTTypePNG; @@ -120,6 +126,10 @@ imageFormat = SDImageFormatHEIC; } else if (CFStringCompare(uttype, kSDUTTypeHEIF, 0) == kCFCompareEqualTo) { imageFormat = SDImageFormatHEIF; + } else if (CFStringCompare(uttype, kUTTypePDF, 0) == kCFCompareEqualTo) { + imageFormat = SDImageFormatPDF; + } else if (CFStringCompare(uttype, kUTTypeScalableVectorGraphics, 0) == kCFCompareEqualTo) { + imageFormat = SDImageFormatSVG; } else { imageFormat = SDImageFormatUndefined; }