Android 张照片的 EXIF 方向字段为空
EXIF Orientation field is empty on Android photos
如果需要,我需要在服务器端旋转图像。为此,我使用了元数据提取器包和 apache commons-imaging,但是对于在 Android 上拍摄的一些照片,我无法使用 java 获得任何方向字段值,但是任何 exif 元数据 reader 网站可以。
例如:
https://imgbbb.com/image/LVtrUD -- 图片
它是使用 Apache Imaging 提取的元数据。
11.10.2019 14:55:35.825 INFO [http-bio-8080-exec-11] **.utils.ExifImageUtils:44 - ORIENTATION 0
[JPEG] - Compression Type = Baseline
[JPEG] - Data Precision = 8 bits
[JPEG] - Image Height = 2448 pixels[JPEG] - Image Width = 3264 pixels
[JPEG] - Number of Components = 3
[JPEG] - Component 1 = Y component: Quantization table 0, Sampling factors 2 horiz/2 vert
[JPEG] - Component 2 = Cb component: Quantization table 1, Sampling factors 1 horiz/1 vert
[JPEG] - Component 3 = Cr component: Quantization table 1, Sampling factors 1 horiz/1 vert
[JFIF] - Version = 1.1
[JFIF] - Resolution Units = inch
[JFIF] - X Resolution = 72 dots
[JFIF] - Y Resolution = 72 dots
[JFIF] - Thumbnail Width Pixels = 0
[JFIF] - Thumbnail Height Pixels = 0
[Exif IFD0] - Make = samsung
[Exif IFD0] - Model = SM-T585
[Exif IFD0] - X Resolution = 72 dots per inch
[Exif IFD0] - Y Resolution = 72 dots per inch
[Exif IFD0] - Resolution Unit = Inch
[Exif IFD0] - Software = T585XXU5CSB1
[Exif IFD0] - Date/Time = 2019:09:12 09:28:02
[Exif IFD0] - YCbCr Positioning = Center of pixel array
[Exif SubIFD] - Exposure Time = 1/33 sec
[Exif SubIFD] - F-Number = f/1.9
[Exif SubIFD] - Exposure Program = Program normal
[Exif SubIFD] - ISO Speed Ratings = 160
[Exif SubIFD] - Exif Version = 2.20
[Exif SubIFD] - Date/Time Original = 2019:09:12 09:28:02
[Exif SubIFD] - Date/Time Digitized = 2019:09:12 09:28:02
[Exif SubIFD] - Components Configuration = YCbCr
[Exif SubIFD] - Shutter Speed Value = 1/33 sec
[Exif SubIFD] - Aperture Value = f/1.9
[Exif SubIFD] - Brightness Value = 1.55
[Exif SubIFD] - Exposure Bias Value = 0 EV
[Exif SubIFD] - Max Aperture Value = f/1.9
[Exif SubIFD] - Metering Mode = Center weighted average
[Exif SubIFD] - Flash = Flash did not fire
[Exif SubIFD] - Focal Length = 2.9 mm
[Exif SubIFD] - Makernote = [98 values]
[Exif SubIFD] - User Comment =
[Exif SubIFD] - Sub-Sec Time = 0731
[Exif SubIFD] - Sub-Sec Time Original = 0731
[Exif SubIFD] - Sub-Sec Time Digitized = 0731
[Exif SubIFD] - FlashPix Version = 1.00
[Exif SubIFD] - Color Space = sRGB
[Exif SubIFD] - Exif Image Width = 3264 pixels
[Exif SubIFD] - Exif Image Height = 2448 pixels
[Exif SubIFD] - Exposure Mode = Auto exposure
[Exif SubIFD] - White Balance Mode = Auto white balance
[Exif SubIFD] - Focal Length 35 = 27 mm
[Exif SubIFD] - Scene Capture Type = Standard
[Exif SubIFD] - Unique Image ID = J08LLJA00AM J08LLLJ01AA
[Interoperability] - Interoperability Index = Recommended Exif Interoperability Rules (ExifR98)
[Interoperability] - Interoperability Version = 1.00
[Exif Thumbnail] - Image Width = 512 pixels
[Exif Thumbnail] - Image Height = 384 pixels
[Exif Thumbnail] - Compression = JPEG (old-style)
[Exif Thumbnail] - Orientation = Unknown (0)
[Exif Thumbnail] - X Resolution = 72 dots per inch
[Exif Thumbnail] - Y Resolution = 72 dots per inch
[Exif Thumbnail] - Resolution Unit = Inch
[Exif Thumbnail] - Thumbnail Offset = 1008 bytes
[Exif Thumbnail] - Thumbnail Length = 33822 bytes
[Huffman] - Number of Tables = 4 Huffman tables
[File Type] - Detected File Type Name = JPEG
[File Type] - Detected File Type Long Name = Joint Photographic Experts Group
[File Type] - Detected MIME Type = image/jpeg
[File Type] - Expected File Name Extension = jpg
[File] - File Name = 1.jpg
[File] - File Size = 3834043 bytes
[File] - File Modified Date = Fri Oct 11 14:55:34 +03:00 2019
是否可以获得正确的方向字段值?
终于使用 ExifTool 解决了我的问题 (https://www.sno.phy.queensu.ca/~phil/exiftool/) and Java Wrapper on it (https://github.com/rkalla/exiftool)
如果需要,我需要在服务器端旋转图像。为此,我使用了元数据提取器包和 apache commons-imaging,但是对于在 Android 上拍摄的一些照片,我无法使用 java 获得任何方向字段值,但是任何 exif 元数据 reader 网站可以。
例如:
https://imgbbb.com/image/LVtrUD -- 图片
它是使用 Apache Imaging 提取的元数据。
11.10.2019 14:55:35.825 INFO [http-bio-8080-exec-11] **.utils.ExifImageUtils:44 - ORIENTATION 0
[JPEG] - Compression Type = Baseline
[JPEG] - Data Precision = 8 bits
[JPEG] - Image Height = 2448 pixels[JPEG] - Image Width = 3264 pixels
[JPEG] - Number of Components = 3
[JPEG] - Component 1 = Y component: Quantization table 0, Sampling factors 2 horiz/2 vert
[JPEG] - Component 2 = Cb component: Quantization table 1, Sampling factors 1 horiz/1 vert
[JPEG] - Component 3 = Cr component: Quantization table 1, Sampling factors 1 horiz/1 vert
[JFIF] - Version = 1.1
[JFIF] - Resolution Units = inch
[JFIF] - X Resolution = 72 dots
[JFIF] - Y Resolution = 72 dots
[JFIF] - Thumbnail Width Pixels = 0
[JFIF] - Thumbnail Height Pixels = 0
[Exif IFD0] - Make = samsung
[Exif IFD0] - Model = SM-T585
[Exif IFD0] - X Resolution = 72 dots per inch
[Exif IFD0] - Y Resolution = 72 dots per inch
[Exif IFD0] - Resolution Unit = Inch
[Exif IFD0] - Software = T585XXU5CSB1
[Exif IFD0] - Date/Time = 2019:09:12 09:28:02
[Exif IFD0] - YCbCr Positioning = Center of pixel array
[Exif SubIFD] - Exposure Time = 1/33 sec
[Exif SubIFD] - F-Number = f/1.9
[Exif SubIFD] - Exposure Program = Program normal
[Exif SubIFD] - ISO Speed Ratings = 160
[Exif SubIFD] - Exif Version = 2.20
[Exif SubIFD] - Date/Time Original = 2019:09:12 09:28:02
[Exif SubIFD] - Date/Time Digitized = 2019:09:12 09:28:02
[Exif SubIFD] - Components Configuration = YCbCr
[Exif SubIFD] - Shutter Speed Value = 1/33 sec
[Exif SubIFD] - Aperture Value = f/1.9
[Exif SubIFD] - Brightness Value = 1.55
[Exif SubIFD] - Exposure Bias Value = 0 EV
[Exif SubIFD] - Max Aperture Value = f/1.9
[Exif SubIFD] - Metering Mode = Center weighted average
[Exif SubIFD] - Flash = Flash did not fire
[Exif SubIFD] - Focal Length = 2.9 mm
[Exif SubIFD] - Makernote = [98 values]
[Exif SubIFD] - User Comment =
[Exif SubIFD] - Sub-Sec Time = 0731
[Exif SubIFD] - Sub-Sec Time Original = 0731
[Exif SubIFD] - Sub-Sec Time Digitized = 0731
[Exif SubIFD] - FlashPix Version = 1.00
[Exif SubIFD] - Color Space = sRGB
[Exif SubIFD] - Exif Image Width = 3264 pixels
[Exif SubIFD] - Exif Image Height = 2448 pixels
[Exif SubIFD] - Exposure Mode = Auto exposure
[Exif SubIFD] - White Balance Mode = Auto white balance
[Exif SubIFD] - Focal Length 35 = 27 mm
[Exif SubIFD] - Scene Capture Type = Standard
[Exif SubIFD] - Unique Image ID = J08LLJA00AM J08LLLJ01AA
[Interoperability] - Interoperability Index = Recommended Exif Interoperability Rules (ExifR98)
[Interoperability] - Interoperability Version = 1.00
[Exif Thumbnail] - Image Width = 512 pixels
[Exif Thumbnail] - Image Height = 384 pixels
[Exif Thumbnail] - Compression = JPEG (old-style)
[Exif Thumbnail] - Orientation = Unknown (0)
[Exif Thumbnail] - X Resolution = 72 dots per inch
[Exif Thumbnail] - Y Resolution = 72 dots per inch
[Exif Thumbnail] - Resolution Unit = Inch
[Exif Thumbnail] - Thumbnail Offset = 1008 bytes
[Exif Thumbnail] - Thumbnail Length = 33822 bytes
[Huffman] - Number of Tables = 4 Huffman tables
[File Type] - Detected File Type Name = JPEG
[File Type] - Detected File Type Long Name = Joint Photographic Experts Group
[File Type] - Detected MIME Type = image/jpeg
[File Type] - Expected File Name Extension = jpg
[File] - File Name = 1.jpg
[File] - File Size = 3834043 bytes
[File] - File Modified Date = Fri Oct 11 14:55:34 +03:00 2019
是否可以获得正确的方向字段值?
终于使用 ExifTool 解决了我的问题 (https://www.sno.phy.queensu.ca/~phil/exiftool/) and Java Wrapper on it (https://github.com/rkalla/exiftool)