I want to know the Image format (i.e. JPFG/PNG etc) of the images which I am getting from the gallery.
My need is to pic images from the gallery of the device and send it to server in Base64 format but the server wants to know image format.
Any help is appreciated.
You can get the file extension from the file path by doing something like this:
Does that fix the issue?
Edited:
Use the following method to retrieve the MIME type of an image from the gallery:
This will return something like "image/jpeg".
Previous answer:
You can use the following code to convert the image from the Gallery to the format you want, like a JPG:
This way you will control the image format your are sending to the server, and can even compress more to save bandwidth. ;)
It is possible to get MIME type with path alone.