Closed yaneury closed 1 year ago
Could you provide an image file that ImageMagick says has Exif but this library says has no Exif?
My super wild guess is that the first file returned by read_dir
does not really have Exif data, and your sample code stops by unwrap
at that point and does not proceed to the remaining files.
It occurred with different types of images. Here's a sample one
And the output from ImageMagick:
❯ identify -verbose index.jpeg
Image:
Filename: index.jpeg
Format: JPEG (Joint Photographic Experts Group JFIF format)
Mime type: image/jpeg
Class: DirectClass
Geometry: 225x225+0+0
Units: Undefined
Colorspace: sRGB
Type: TrueColor
Base type: Undefined
Endianness: Undefined
Depth: 8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 8-bit
Channel statistics:
Pixels: 50625
Red:
min: 28 (0.109804)
max: 255 (1)
mean: 241.801 (0.948238)
standard deviation: 24.7243 (0.096958)
kurtosis: 2.26448
skewness: -1.76917
entropy: 0.382322
Green:
min: 16 (0.0627451)
max: 255 (1)
mean: 238.729 (0.936193)
standard deviation: 32.4425 (0.127225)
kurtosis: 6.62594
skewness: -2.41441
entropy: 0.388998
Blue:
min: 0 (0)
max: 255 (1)
mean: 234.622 (0.920088)
standard deviation: 39.7632 (0.155934)
kurtosis: 6.38241
skewness: -2.37785
entropy: 0.404171
Image statistics:
Overall:
min: 0 (0)
max: 255 (1)
mean: 238.384 (0.93484)
standard deviation: 32.31 (0.126706)
kurtosis: 7.66558
skewness: -2.49239
entropy: 0.39183
Rendering intent: Perceptual
Gamma: 0.454545
Chromaticity:
red primary: (0.64,0.33)
green primary: (0.3,0.6)
blue primary: (0.15,0.06)
white point: (0.3127,0.329)
Background color: white
Border color: srgb(223,223,223)
Matte color: grey74
Transparent color: black
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 225x225+0+0
Dispose: Undefined
Iterations: 0
Compression: JPEG
Quality: 74
Orientation: Undefined
Properties:
date:create: 2022-11-14T20:27:08+00:00
date:modify: 2022-11-14T20:27:08+00:00
jpeg:colorspace: 2
jpeg:sampling-factor: 2x2,1x1,1x1
signature: 493881774b51a76ac07c3c14c78e20c31cb50a2c307ec95b0c5909cdba72cfaf
Artifacts:
filename: index.jpeg
verbose: true
Tainted: False
Filesize: 2798B
Number pixels: 50625
Pixels per second: 114.392MB
User time: 0.000u
Elapsed time: 0:01.000
Version: ImageMagick 6.9.11-60 Q16 x86_64 2021-01-25 https://imagemagick.org
That sample does not have Exif data.
ImageMagick will output "Profiles-exif: x bytes" line for an image with Exif:
Image:
Filename: sample_with_exif.jpg
Format: JPEG (Joint Photographic Experts Group JFIF format)
Mime type: image/jpeg
...
Profiles:
Profile-exif: 10362 bytes <-- See this line
Properties:
date:create: 2014-09-02T20:54:50+00:00
date:modify: 2014-09-02T20:54:50+00:00
date:timestamp: 2022-11-15T01:28:38+00:00
exif:ApertureValue: 390/100 <-- Exif attributes are printed like these
exif:BrightnessValue: 199/100
exif:ColorSpace: 1
exif:ComponentsConfiguration: ....
exif:CompressedBitsPerPixel: 32/10
exif:Copyright:
exif:CustomRendered: 0
exif:DateTime: 2014:09:02 21:47:18
exif:DateTimeDigitized: 2014:09:02 21:47:18
exif:DateTimeOriginal: 2014:09:02 21:47:18
exif:ExifOffset: 294
exif:ExifVersion: 0220
...
Version: ImageMagick 7.1.0-47 Q8 x64 47c6f10:20220827 https://imagemagick.org
Oh my mistake. Didn't know where that metadata was coming from. Good catch!
Hi! I'm trying the sample code to output the EXIF metadata for all images in a directory:
But the call to
read_from_container
is failing for all images I throw at it, e.g.jpeg
,png
. These are files that are confirmed to have EXIF metadata throughidentify -verbose <filename>
The error I'm seeing is:
Any idea what I'm doing wrong?