Skip to content

Reading Exif Data Fails #44

@tehprofessor

Description

@tehprofessor

Howdy,

When I attempt read EXIF data from an image, it fails with:

img.get('exif-Orientation')
VIPS::Error: VIPS error: vips_image_get: field "exif-Orientation" not found

I've attached the image in question:

tall-iphone-photo

If I use header -a tall-iphone-photo.jpg it works and I get:

tall-iphone-photo.jpg: 3264x2448 uchar, 3 bands, srgb, partial VipsImage (0x7ff54b03e030)
width: 3264
height: 2448
bands: 3
format: 0 - uchar
coding: 0 - none
interpretation: 22 - srgb
xoffset: 0
yoffset: 0
xres: 2.834646
yres: 2.834646
filename: "tall-iphone-photo.jpg"
jpeg-multiscan: 0
exif-data: VIPS_TYPE_BLOB, data = 0x7ff54b048600, length = 12284
exif-Manufacturer: Apple (Apple, ASCII, 6 components, 6 bytes)
exif-Model: iPhone 5 (iPhone 5, ASCII, 9 components, 9 bytes)
exif-Orientation: 6 (Right-top, Short, 1 components, 2 bytes)
exif-Software: 6.1.4 (6.1.4, ASCII, 6 components, 6 bytes)
exif-Date and Time: 2013:07:24 15:18:39 (2013:07:24 15:18:39, ASCII, 20 components, 20 bytes)
exif-YCbCr Positioning: 1 (Centered, Short, 1 components, 2 bytes)
exif-Compression: 6 (JPEG compression, Short, 1 components, 2 bytes)
exif-X-Resolution: 72 (72, Rational, 1 components, 8 bytes)
exif-Y-Resolution: 72 (72, Rational, 1 components, 8 bytes)
exif-Resolution Unit: 2 (Inch, Short, 1 components, 2 bytes)
exif-Exposure Time: 0.050000000000000003 (1/20 sec., Rational, 1 components, 8 bytes)
exif-F-Number: 2.3999999999999999 (f/2.4, Rational, 1 components, 8 bytes)
exif-Exposure Program: 2 (Normal program, Short, 1 components, 2 bytes)
exif-ISO Speed Ratings: 64 (64, Short, 1 components, 2 bytes)
exif-Exif Version: Exif Version 2.21 (Exif Version 2.21, Undefined, 4 components, 4 bytes)
exif-Date and Time (Original): 2013:07:24 15:18:39 (2013:07:24 15:18:39, ASCII, 20 components, 20 bytes)
exif-Date and Time (Digitized): 2013:07:24 15:18:39 (2013:07:24 15:18:39, ASCII, 20 components, 20 bytes)
exif-Components Configuration: Y Cb Cr - (Y Cb Cr -, Undefined, 4 components, 4 bytes)
exif-Shutter Speed: 4.3219567690557454 (4.32 EV (1/20 sec.), SRational, 1 components, 8 bytes)
exif-Aperture: 2.5260688216892597 (2.53 EV (f/2.4), Rational, 1 components, 8 bytes)
exif-Brightness: 2.6485933503836319 (2.65 EV (21.48 cd/m^2), SRational, 1 components, 8 bytes)
exif-Metering Mode: 5 (Pattern, Short, 1 components, 2 bytes)
exif-Flash: 24 (Flash did not fire, auto mode, Short, 1 components, 2 bytes)
exif-Focal Length: 4.1299999999999999 (4.1 mm, Rational, 1 components, 8 bytes)
exif-Subject Area: 1631 1223 881 881 (Within rectangle (width 881, height 881) around (x,y) = (1631,1223), Short, 4 components, 8 bytes)
exif-FlashPixVersion: FlashPix Version 1.0 (FlashPix Version 1.0, Undefined, 4 components, 4 bytes)
exif-Color Space: 1 (sRGB, Short, 1 components, 2 bytes)
exif-Pixel X Dimension: 3264 (3264, Long, 1 components, 4 bytes)
exif-Pixel Y Dimension: 2448 (2448, Long, 1 components, 4 bytes)
exif-Sensing Method: 2 (One-chip color area sensor, Short, 1 components, 2 bytes)
exif-Exposure Mode: 0 (Auto exposure, Short, 1 components, 2 bytes)
exif-White Balance: 0 (Auto white balance, Short, 1 components, 2 bytes)
exif-Focal Length in 35mm Film: 33 (33, Short, 1 components, 2 bytes)
exif-Scene Capture Type: 0 (Standard, Short, 1 components, 2 bytes)
exif-Interoperability Index: N (N, ASCII, 2 components, 2 bytes)
exif-Interoperability Version: 45 31.5 0 (45, 31.50,  0, Rational, 3 components, 24 bytes)
exif-East or West Longitude: W (W, ASCII, 2 components, 2 bytes)
exif-Longitude: 122 41.079999999999998 0 (122, 41.08,  0, Rational, 3 components, 24 bytes)
exif-Altitude Reference: Sea level (Sea level, Byte, 1 components, 1 bytes)
exif-Altitude: 18.448275862068964 (18.45, Rational, 1 components, 8 bytes)
exif-GPS Time (Atomic Clock): 22 18 38.43 (22:18:38.43, Rational, 3 components, 24 bytes)
exif-GPS Image Direction Reference: T (T, ASCII, 2 components, 2 bytes)
exif-GPS Image Direction: 281.27149321266967 (281.271, Rational, 1 components, 8 bytes)
resolution-unit: in
jpeg-thumbnail-data: VIPS_TYPE_BLOB, data = 0x7ff54b04d600, length = 8174

I'm not sure if I'm doing something wrong? I've tried it using libvips versions vips-7.32.2 and vips-7.34.1 on Debian Wheezy (7.1).

Any help would be greatly appreciated. The goal is to orient the photo, then remove the exif-orientation data, so that it displays the same on all browsers-- maybe there's a built in way to do this already?

Best,
Seve

Update

The plot thickens, if I use vips version 7.30.2, on OS X, then I get:

img.get('exif-Orientation')
=> "6 (Right-top, Short, 1 components, 2 bytes)"

I'm going to install 7.30.2 on my Debian machine and see if it fixes it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions