Please help,
I currently upload an image to my web-service which does have the EXIF data attached to it at time of upload. When it arrives on the server, it is minus it’s exif data.
Bitmap bmp = BitmapFactory.decodeFile(fullFileName); if (bmp == null) { //oh sugar, not cool continue; } ByteArrayOutputStream stream = new ByteArrayOutputStream(); bmp.compress(Bitmap.CompressFormat.JPEG, 60, stream); byte[] byteArray = stream.toByteArray(); DefaultHttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost("webserviceurl"); ByteArrayEntity test = new ByteArrayEntity(byteArray){...} post.setEntity(test);
Before I upload the image, it’s stored to the devices SD card to which is then decoded using the BitmapFactory class.
I’m thinking its during the image compression that its lost, anybody got a solution or idea ?
Thanks
Burrows111
Advertisement
Answer
EXIF data is stripped during encode. However, ExifInterface will allow you to set the EXIF data on the compressed file. Unfortunately, you’ll need to compress the image, write it to a file, then set the EXIF on the file, and finally upload that.