android "android" 修改 jpg exif 属性,Android ExifInterface saveAttributes()不覆盖以前的数据?...

public void saveAttributes()

Added in API level 5

Save the tag data into the JPEG file. This is expensive because it involves copying all the JPG data from one file to another and deleting the old file and renaming the other. It's best to use setAttribute(String, String) to set all attributes to write and make a single call rather than multiple calls for each attribute.

Throws

IOException

它清楚地说,这是复制ALL的数据,包括你说是消失了的东西。你可能会发布你正在测试的东西吗?如果你在Android Studio上,你可以尝试File - > Invalidate Caches/Restart - > Invalidate and Restart。

正如其他人所指出的,你必须从 原始图像复制的EXIF数据到最终调整图像。桑塞兰的Android 库通常最适合这一点。根据Android操作系统版本, ExifInterface有时会破坏EXIF数据。此外,ExifInterface还处理有限数量的Exif标签 - 即仅“知道”标签的 。另一方面Sanselan将 保留所有EXIF标记和标记笔记。 这是一篇博客文章,展示如何使用Sanselan复制图像数据: http://bricolsoftconsulting.com/copying-exif-metadata-using-sanselan/ 顺便说一句,在Android上我也倾向于旋转图像并删除Orientation EXIF标签。例如,在搭载Android 4.03的Nexus S上, 相机在EXIF元数据中设置了方向标签,但是网页视图忽略了该信息并且错误地显示了图像。 不幸的是,旋转实际图像数据并删除方向标记是唯一的方法,让每个程序正确显示图像 。

我希望这会有所帮助。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值