java - Is there any way to find out the extensions of the Images stored in a database as binary data? -
i have product details including product image(binary data) mssql database , store locally on android device image files, don't know type of images. think when we're storing images files extension matters, if matters there way find out image extensions?
thanks , regards.
you can use bitmapfactory.options.outmimetype that. contain string image/png
or image/jpg
after image decoded.
sample:
inputstream in = getassets().open("image.file"); bitmapfactory.options opts = new bitmapfactory.options(); bitmapfactory.decodestream(in, null, opts); log.d(tag, "mime type: " + opts.outmimetype);
in case writes in log:
05-31 15:20:34.131: d/test(3803): mime type: image/jpeg
Comments
Post a Comment