I want to know what format some image file is. There are actually only 2 or 3 possible options: jpeg, png and possibly bmp, but the file extension is always png. How to get the actual format of that image on android?
As hexadecimal codes:
JPEG image files begin with FF D8 FF E0
or FF D8 FF DB
PNG image files begin with 89 50 4E 47 0D 0A 1A 0A
BMP image files begin with 42 4D
If you're certain only three file formats will be used, you just need the first byte to differentiate them!
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments