Android Utililty Methods Image Type Get

List of utility methods to do Image Type Get

Description

The list of methods to do Image Type Get are organized into topic(s).

Method

StringguessImageType(final byte[] input)
Guesses the format of input image.
if (input == null) {
    return null;
if (input.length >= 3 && input[0] == 'G' && input[1] == 'I'
        && input[2] == 'F') {
    return "GIF";
} else if (input.length >= 4 && input[0] == (byte) 0x89
        && input[1] == 'P' && input[2] == 'N' && input[3] == 'G') {
...
booleancheckAndroidImageFormat(Image image)
check Android Image Format
int format = image.getFormat();
Plane[] planes = image.getPlanes();
switch (format) {
case ImageFormat.YUV_420_888:
case ImageFormat.NV21:
case ImageFormat.YV12:
    return 3 == planes.length;
case ImageFormat.JPEG:
...
StringgetFileSuffix(byte[] bytes)
get File Suffix
if (bytes == null || bytes.length < 10) {
    return null;
if (bytes[0] == 'G' && bytes[1] == 'I' && bytes[2] == 'F') {
    return "GIF";
} else if (bytes[1] == 'P' && bytes[2] == 'N' && bytes[3] == 'G') {
    return "PNG";
} else if (bytes[6] == 'J' && bytes[7] == 'F' && bytes[8] == 'I'
...