How to rotate JPEG images based on the orientation metadata?

后端 未结 8 1808
轻奢々
轻奢々 2020-11-27 12:30

I have some server code that is generating thumbnails when an image is uploaded. The issue is that when the image was taken and the camera/device was rotated, the thumbnail

8条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-27 13:13

    Exif seems to be hard to write because of proprietary stuff in it. However, you can consider another option

    Read original but only write orientation tag to thumbnails.

    Apache Sanselan seems to have nice collection of tools to do it.

    http://commons.apache.org/proper/commons-imaging/

    Look at ExifRewriter class, for example.

提交回复
热议问题