Package com.itextpdf.io.image
Class ImageTypeDetector
java.lang.Object
com.itextpdf.io.image.ImageTypeDetector
Helper class that detects image type by magic bytes
-
Method Summary
Modifier and TypeMethodDescriptionstatic ImageType
detectImageType
(byte[] source) Detect image type by magic bytes given the byte array source.static ImageType
detectImageType
(InputStream stream) Detect image type by magic bytes given the input stream.static ImageType
detectImageType
(URL source) Detect image type by magic bytes given the source URL.
-
Method Details
-
detectImageType
Detect image type by magic bytes given the byte array source.- Parameters:
-
source
- image bytes - Returns:
-
detected image type, see
ImageType
. ReturnsImageType.NONE
if image type is unknown
-
detectImageType
Detect image type by magic bytes given the source URL.- Parameters:
-
source
- image URL - Returns:
-
detected image type, see
ImageType
. ReturnsImageType.NONE
if image type is unknown
-
detectImageType
Detect image type by magic bytes given the input stream.- Parameters:
-
stream
- image stream - Returns:
-
detected image type, see
ImageType
. ReturnsImageType.NONE
if image type is unknown
-