uni-app icon indicating copy to clipboard operation
uni-app copied to clipboard

uni.getImageInfo不能正确获取图片方向

Open SilentGene opened this issue 1 year ago • 0 comments

问题描述 用uni.getImageInfo在安卓平台测试获取图片的orientation,无论是横向还是竖向的图,都返回up, 但实际上用手机图片详情或者图虫exif查看,都可以看到横图被标注为180,竖图被标为90.

复现步骤 示例图片: 2024-01-28-19-05-13-751

图虫exif信息: Snipaste_2024-01-28_20-57-35

而用uniapp获取到的信息: image

贴上代码:

methods: {
    selectImage() {
      uni.chooseImage({
        count: 1,
        sizeType: ['original'],
        sourceType: ['album'],
        success: (res) => {
          this.imageSrc = res.tempFilePaths[0];
          // 获取图片信息以便后续处理
          uni.getImageInfo({
            src: this.imageSrc,
            success: (info) => {
			  console.log('图片信息:', info)
...

预期结果 正确获取图片方向:90

实际结果

{
    "path": "file:///storage/emulated/0/DCIM/Camera/2024-01-28-19-05-13-751.jpg",
    "width": 4022,
    "height": 3016,
    "orientation": "up",
    "type": "jpeg",
    "errMsg": "getImageInfo:ok"
}

系统信息:

  • 发行平台: 安卓
  • 操作系统 Android 11
  • HBuilderX版本 3.99
  • uni-app版本 不太清楚,是用的vue3编写
  • 设备信息 小米6+LineageOS 20

补充信息 另外附上一张横向的图片,图虫exif正确识别方向为180,而uniapp一样返回up 2024-01-28-20-14-51-554 image image

SilentGene avatar Jan 28 '24 11:01 SilentGene