我将JPG图像上传为byte [],但是在转换为byte []之前EXIF的Bitmap条带。如何上传原始jpg而不将其转换为位图?Android:上传JPG图像而不会丢失EXIF
File imagefile = new File(filepath + "DSC00021.jpg");
FileInputStream fis = new FileInputStream(imagefile);
Bitmap bi = BitmapFactory.decodeStream(fis); // EXIF info lost
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bi.compress(Bitmap.CompressFormat.JPG, 100, baos);
byte[] data = baos.toByteArray();
p.s.我不想使用任何第三方库。 ExifInterface只能写入文件而不能写入流/字节数组。
为什么不把整个文件内容从FileInputStream读到字节数组而不是转换成Bitmap对象?谷歌搜索会给你吨结果如何获得一个文件的内容到一个字节数组。 – 2011-12-20 05:17:25