List of utility methods to do Image Type Get
String | guessImageType(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') { ... |
boolean | checkAndroidImageFormat(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: ... |
String | getFileSuffix(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' ... |