JS Client-Side Exif Orientation: Rotate and Mirror JPEG Images

前端 未结 12 1027
花落未央
花落未央 2020-11-22 11:59

Digital camera photos are often saved as JPEG with an EXIF \"orientation\" tag. To display correctly, images need to be rotated/mirrored depending on which orientation is se

12条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-22 12:17

    One liner anyone?

    I haven't seen anyone mention the browser-image-compression library. It's got a helper function perfect for this.

    Usage: const orientation = await imageCompression.getExifOrientation(file)

    Such a useful tool in many other ways too.

提交回复
热议问题