Bug #1135
Read Makernotes
100%
Description
Hello
I'm baffled. By googling, I found a few places which seem to imply that exiv2 can read (and write?) makernotes, but I can't figure out how to do that. Does exiv2 support reading makernotes? If so, how?
This is the image whose makernotes I'm trying to read:
http://www.imaging-resource.com/PRODS/pentax-645z/YIMGP2303.DNG.HTM
And yes, I know how to do it with exiftool.
Kind regards
Related issues
History
Updated by Robin Mills about 6 years ago
- Category set to not-a-bug
- Status changed from New to Closed
- Assignee set to Alan Pater
- Target version set to 0.26
exiv2 can read maker notes. I don't believe exiv2 can rewrite maker notes. We have reversed engineered the data in many of the makernotes. We have documented this, and our sources of information about makernotes here: http://www.exiv2.org/makernote.html
Updated by Schnitzel Foo about 6 years ago
exiv2 -g Pentax YIMGP2303.DNG
That outputs nothing. I also tried PENTAX. Does it work on your end?
I'm using exiv2-0.24-r1 (Gentoo)
Updated by Robin Mills about 6 years ago
Mr Foo
I am very not comfortable about the tone of your voice. That file seems to be working fine. As the saying goes "What's your beef, buddy?".
960 rmills@rmillsmbp:~/temp $ exiv2 -pa ~/Downloads/YIMGP2303.DNG Exif.Image.NewSubfileType Long 1 Thumbnail/Preview image Exif.Image.ImageWidth Long 1 160 Exif.Image.ImageLength Long 1 120 Exif.Image.BitsPerSample Short 3 8 8 8 Exif.Image.Compression Short 1 Uncompressed Exif.Image.PhotometricInterpretation Short 1 RGB Exif.Image.Make Ascii 30 RICOH IMAGING COMPANY, LTD. Exif.Image.Model Ascii 20 PENTAX 645Z Exif.Image.StripOffsets Long 1 153696 Exif.Image.Orientation Short 1 top, left Exif.Image.SamplesPerPixel Short 1 3 Exif.Image.RowsPerStrip Long 1 120 Exif.Image.StripByteCounts Long 1 57600 Exif.Image.XResolution Rational 1 300 Exif.Image.YResolution Rational 1 300 Exif.Image.PlanarConfiguration Short 1 1 Exif.Image.ResolutionUnit Short 1 inch Exif.Image.Software Ascii 30 PENTAX 645Z Ver. 1.00 Exif.Image.DateTime Ascii 20 2014:08:29 01:55:20 Exif.Image.Artist Ascii 1 Exif.Image.SubIFDs Long 2 152554 152960 Exif.SubImage1.NewSubfileType Long 1 Primary image Exif.SubImage1.ImageWidth Long 1 8384 Exif.SubImage1.ImageLength Long 1 6208 Exif.SubImage1.BitsPerSample Short 1 14 Exif.SubImage1.Compression Short 1 JPEG Exif.SubImage1.PhotometricInterpretation Short 1 Color Filter Array Exif.SubImage1.StripOffsets Long 1 211296 Exif.SubImage1.SamplesPerPixel Short 1 1 Exif.SubImage1.RowsPerStrip Long 1 6208 Exif.SubImage1.StripByteCounts Long 1 83045975 Exif.SubImage1.XResolution Rational 1 300 Exif.SubImage1.YResolution Rational 1 300 Exif.SubImage1.PlanarConfiguration Short 1 1 Exif.SubImage1.ResolutionUnit Short 1 inch Exif.SubImage1.CFARepeatPatternDim Short 2 2 2 Exif.SubImage1.CFAPattern Byte 4 0 1 1 2 Exif.SubImage1.CFALayout Short 1 Rectangular (or square) layout Exif.SubImage1.BlackLevelRepeatDim Short 2 2 2 Exif.SubImage1.BlackLevel Long 4 41 16 68 71 Exif.SubImage1.WhiteLevel Long 1 15590 Exif.SubImage1.DefaultScale Rational 2 1/1 1/1 Exif.SubImage1.DefaultCropOrigin Long 2 6 4 Exif.SubImage1.DefaultCropSize Long 2 8256 6192 Exif.SubImage1.BayerGreenSplit Long 1 0 Exif.SubImage1.AntiAliasStrength Rational 1 1/1 Exif.SubImage1.ActiveArea Long 4 4 52 6204 8320 Exif.SubImage2.NewSubfileType Long 1 Thumbnail/Preview image Exif.SubImage2.ImageWidth Long 1 8256 Exif.SubImage2.ImageLength Long 1 6192 Exif.SubImage2.BitsPerSample Short 3 8 8 8 Exif.SubImage2.Compression Short 1 JPEG Exif.SubImage2.PhotometricInterpretation Short 1 YCbCr Exif.SubImage2.StripOffsets Long 1 83257280 Exif.SubImage2.SamplesPerPixel Short 1 3 Exif.SubImage2.RowsPerStrip Long 1 6192 Exif.SubImage2.StripByteCounts Long 1 6600261 Exif.SubImage2.XResolution Rational 1 300 Exif.SubImage2.YResolution Rational 1 300 Exif.SubImage2.PlanarConfiguration Short 1 1 Exif.SubImage2.ResolutionUnit Short 1 inch Exif.SubImage2.WhitePoint Rational 2 313/1000 329/1000 Exif.SubImage2.PrimaryChromaticities Rational 6 64/100 33/100 30/100 60/100 15/100 6/100 Exif.SubImage2.YCbCrCoefficients Rational 3 299/1000 587/1000 114/1000 Exif.SubImage2.YCbCrSubSampling Short 2 2 1 Exif.SubImage2.YCbCrPositioning Short 1 Co-sited Exif.SubImage2.PreviewColorSpace Long 1 2 Exif.Image.Copyright Ascii 1 Exif.Image.ExifTag Long 1 153318 Exif.Photo.ExposureTime Rational 1 1/200 s Exif.Photo.FNumber Rational 1 F8 Exif.Photo.ExposureProgram Short 1 Not defined Exif.Photo.ISOSpeedRatings Short 1 65535 Exif.Photo.SensitivityType Short 1 1 Exif.Photo.StandardOutputSensitivity Long 1 204800 Exif.Photo.DateTimeOriginal Ascii 20 2014:08:29 01:55:20 Exif.Photo.DateTimeDigitized Ascii 20 2014:08:29 01:55:20 Exif.Photo.ExposureBiasValue SRational 1 +7/10 EV Exif.Photo.MeteringMode Short 1 Multi-segment Exif.Photo.Flash Short 1 No, compulsory Exif.Photo.FocalLength Rational 1 120.0 mm Exif.Photo.SensingMethod Short 1 One-chip color area Exif.Photo.CustomRendered Short 1 Normal process Exif.Photo.ExposureMode Short 1 Auto bracket Exif.Photo.WhiteBalance Short 1 Auto Exif.Photo.FocalLengthIn35mmFilm Short 1 94.0 mm Exif.Photo.SceneCaptureType Short 1 Standard Exif.Photo.Contrast Short 1 Normal Exif.Photo.Saturation Short 1 Normal Exif.Photo.Sharpness Short 1 Normal Exif.Photo.SubjectDistanceRange Short 1 Distant view Exif.Image.GPSTag Long 1 153660 Exif.GPSInfo.GPSVersionID Byte 4 2.3.0.0 Exif.Image.DNGVersion Byte 4 1 2 0 0 Exif.Image.DNGBackwardVersion Byte 4 1 2 0 0 Exif.Image.UniqueCameraModel Ascii 12 PENTAX 645Z Exif.Image.ColorMatrix1 SRational 9 77099/65536 -39421/65536 -5153/65536 -22070/65536 64783/65536 26706/65536 -1438/65536 3185/65536 49984/65536 Exif.Image.ColorMatrix2 SRational 9 64417/65536 -20313/65536 -8328/65536 -24149/65536 79517/65536 11278/65536 -6996/65536 12954/65536 44921/65536 Exif.Image.AnalogBalance Rational 3 256/256 256/256 256/256 Exif.Image.AsShotNeutral Rational 3 256/424 256/256 256/563 Exif.Image.BaselineExposure SRational 1 -37474/65536 Exif.Image.BaselineNoise Rational 1 1/1 Exif.Image.BaselineSharpness Rational 1 1/1 Exif.Image.LinearResponseLimit Rational 1 1/1 Exif.Image.DNGPrivateData Byte 151552 (Binary value suppressed) Exif.MakerNote.Offset Long 1 926 Exif.MakerNote.ByteOrder Ascii 3 II Exif.PentaxDng.Version Byte 4 11.2.1.0 Exif.PentaxDng.Mode Short 1 Auto Exif.PentaxDng.PreviewResolution Short 2 720x480 Exif.PentaxDng.PreviewLength Long 1 51062 Exif.PentaxDng.PreviewOffset Long 1 75746 Exif.PentaxDng.ModelID Long 1 645Z Exif.PentaxDng.Date Undefined 4 2014:08:29 Exif.PentaxDng.Time Undefined 3 01:55:20 Exif.PentaxDng.Quality Short 1 RAW Exif.PentaxDng.Flash Short 2 Off, Did not fire Exif.PentaxDng.Focus Short 1 AF-S Exif.PentaxDng.AFPoint Short 2 Auto Exif.PentaxDng.AFPointInFocus Long 1 (128) Exif.PentaxDng.ExposureTime Long 1 5 ms Exif.PentaxDng.FNumber Short 1 F8 Exif.PentaxDng.ISO Short 1 204800 Exif.PentaxDng.ExposureCompensation SShort 1 0.7 EV Exif.PentaxDng.MeteringMode Short 1 Multi Segment Exif.PentaxDng.AutoBracketing Short 2 8.2e+03 EV (No extended bracketing) Exif.PentaxDng.WhiteBalance Short 1 Auto Exif.PentaxDng.FocalLength Long 1 120.0 mm Exif.PentaxDng.Saturation Short 1 Normal Exif.PentaxDng.Contrast Short 1 Normal Exif.PentaxDng.Sharpness Short 1 Normal Exif.PentaxDng.DSPFirmwareVersion Undefined 4 254 255 255 253 Exif.PentaxDng.EffectiveLV Short 1 3328 Exif.PentaxDng.PictureMode Byte 3 MTF Program Exif.PentaxDng.DriveMode Byte 4 Self-timer (12 sec) Exif.PentaxDng.ColorSpace Short 1 sRGB Exif.PentaxDng.PreviewImageBorders Byte 4 0 0 40 40 Exif.PentaxDng.LensType Byte 4 smc PENTAX-FA 645 Macro 120mm F4 Exif.PentaxDng.Temperature SByte 1 19 C Exif.PentaxDng.AELock Short 1 Off Exif.PentaxDng.NoiseReduction Short 1 Off Exif.PentaxDng.FlashExposureCompensation SByte 2 0 EV Exif.PentaxDng.ImageTone Short 1 Portrait Exif.PentaxDng.ColorTemperature Short 1 0 Exif.PentaxDng.ShutterCount Undefined 4 249 22 235 79 Exif.PentaxDng.DynamicRangeExpansion Undefined 4 Unknown (0x00020000) Exif.PentaxDng.HighISONoiseReduction Byte 2 (255 4) Exif.PentaxDng.AFAdjustment SShort 1 0 Exif.PentaxDng.BlackPoint Short 4 41 16 68 71 Exif.PentaxDng.WhitePoint Short 4 13568 8192 8192 18016 Exif.PentaxDng.ShotInfo Undefined 33 2 3 0 0 1 6 0 0 64 0 120 2 2 121 103 32 64 2 17 0 1 12 0 5 5 3 0 0 0 0 0 0 0 Exif.PentaxDng.AEInfo Undefined 48 0 0 128 4 150 0 0 0 0 0 0 0 0 0 0 0 130 115 120 64 251 0 64 0 0 2 0 3 100 99 148 164 1 12 38 50 46 1 9 1 0 0 0 0 0 0 0 0 Exif.PentaxDng.LensInfo Undefined 128 0 139 160 90 0 7 3 192 0 0 0 0 0 0 0 0 31 180 43 56 0 116 5 79 131 193 138 120 164 129 63 5 255 255 255 7 3 116 4 111 0 186 9 116 4 109 0 27 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 207 160 2 96 7 235 234 0 4 255 64 60 250 2 3 138 236 104 132 8 146 68 170 98 146 131 128 3 58 80 112 17 206 231 15 180 182 164 144 71 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Exif.PentaxDng.FlashInfo Undefined 36 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 63 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 Exif.PentaxDng.AEMeteringSegments Undefined 4050 (Binary value suppressed) Exif.PentaxDng.FlashADump Undefined 1350 (Binary value suppressed) Exif.PentaxDng.FlashBDump Undefined 1350 (Binary value suppressed) Exif.PentaxDng.CameraInfo Long 5 77840 20140609 2 1 1000619 Exif.PentaxDng.BatteryInfo Undefined 20 242 80 2 178 2 155 0 0 0 0 0 0 0 0 0 0 0 0 77 0 Exif.PentaxDng.AFInfo Undefined 1024 (Binary value suppressed) Exif.PentaxDng.ColorInfo Undefined 18 123 32 120 31 137 31 140 32 180 32 122 32 131 31 141 31 0 0 Exif.PentaxDng.SerialNumber Ascii 20 4948501 Exif.Image.CalibrationIlluminant1 Short 1 17 Exif.Image.CalibrationIlluminant2 Short 1 21 Exif.Image.PreviewColorSpace Long 1 2 961 rmills@rmillsmbp:~/temp $This matter is closed.
Updated by Andreas Huggel about 6 years ago
Exiv2 can update any metadata tag that it reads (with some deliberate exceptions), including Makernote tags. All tags are updated the same way, so once you understand how to update a regular (Exif) tag, you can do the same thing with any makernote tag. In the example (see the output that Robin posted), the Exif.PentaxDng.*
tags are the makernote tags. Try something like exiv2 -M'set Exif.PentaxDng.SerialNumber ABCDEF'
to set a tag and see the Command line utility section on the Getting Started page on the website to learn more.
PS: Maybe a DNG image is not the best example for an image with a makernote, I suggest you use a JPEG image to experiment.
PPS: A question like this is better asked in the forum. If you file it as a bug, like you did, we expect you found an issue with the software; something that is not working as designed, as opposed to something you have not figured out yet.
Updated by Schnitzel Foo about 6 years ago
"I am very not comfortable about the tone of your voice. That file seems to be working fine. As the saying goes "What's your beef, buddy?"."
I beg your pardon? I came here either politely asking for clarification or reporting a bug, whichever it turns out to be, and I get the above response...
Andreas: thank you. I am quite familiar with using exiv2 already and have been doing so for years. The file I posted a link to returns no makernotes when run through exiv2 on my end, ergo I asked whether it works on "your" end. I downloaded it twice, so it's unlikely to be a corrupt download. That is why I opened an issue here - in case it turns out to be a bug, which it apparently has. But as none of the people who responded here could reproduce the problem, I presume it has already been fixed in whichever version of exiv2 you're all using - which version is that? I'm on what Gentoo calls the latest stable, 0.24-r1. The r1 means it has the following two patches applied: https://dpaste.de/Mp5T
MD5: 6472e19996d12fc2215a5b44f1ef68b2 YIMGP2303.DNG
Updated by Robin Mills about 6 years ago
It didn't feel polite to me. Quite the opposite.
I'm using the current trunk (svn r4015 or so). I'm not aware of any recent change in exiv2 which would affect the output. I'll build the current release (v0.25) later and look at your file. I'll be a little surprised if the output is different.
Updated by Alan Pater about 6 years ago
Schnitzel Foo wrote:
I'm on what Gentoo calls the latest stable, 0.24-r1.
exiv2 0.25 has had a ton of updates and bug fixes, including a lot of additional makernote support.
It has been packaged for Gentoo: https://packages.gentoo.org/packages/media-gfx/exiv2
Updated by Schnitzel Foo about 6 years ago
That must be it then. Let's leave this issue closed, and I'll update it in the unlikely event that I can reproduce it in 0.25. Thank you.
Updated by Robin Mills about 6 years ago
Mr Foo:
I'm owe you an apology. There are two things which are not right here.
- exiv2 does not appear to list the makernotes in a DNG in v0.24
- the option -g (--grep) is not used by the default exiv2 output (-ps = Print Summary). -g is applied to -pa and other outputs.
I don't recall modifying the DNG code in the last few years. However clearly something about MakerNote/DNG was changed for v0.25.
exiv2 -pa -g Pentax produces 55 lines of output extracted from the makernotes on v0.25 and later:
.../trunk $ sudo make install > /dev/null; exiv2 -vV | grep -e exiv2 -e svn ; exiv2 -pa ~/Downloads/YIMGP2303.DNG | grep Pentax | wc exiv2 0.25 001900 (64 bit build) exiv2=0.25.0 svn=4014 executable=/usr/local/bin/exiv2 library=/usr/local/lib/libexiv2.14.dylib 55 547 4592 <------------- .../trunk $ cd ../0.25 .../0.25 $ sudo make install > /dev/null; exiv2 -vV | grep -e exiv2 -e svn ; exiv2 -pa ~/Downloads/YIMGP2303.DNG | grep Pentax | wc exiv2 0.25 001900 (64 bit build) exiv2=0.25.0 svn=0 executable=/usr/local/bin/exiv2 library=/usr/local/lib/libexiv2.14.dylib /Users/rmills/Downloads/YIMGP2303.DNG: (No XMP data found in the file) 55 547 4592 <------------- .../0.25 $ cd ../0.24 .../0.24 $ sudo make install > /dev/null; exiv2 -vV | grep -e exiv2 -e svn ; exiv2 -pa ~/Downloads/YIMGP2303.DNG | grep Pentax | wc exiv2 0.24 001800 (64 bit build) exiv2=0.24.0 executable=/usr/local/bin/exiv2 library=/usr/local/lib/libexiv2.13.dylib 0 0 0 <------------- .../0.24 $I have been aware for a few weeks the -g does not work with -ps. I'm not sure if that's really a bug. It is after all intended to be a summary. I investigated this a few weeks ago and thought "this is more trouble to fix than it's worth". I'm going to log an issue about it. However I think I'll document this in the man page and leave the code alone.
And just for grins, you can see there's a lot less output for your file with v0.24.
.../trunk $ exiv2 -pa ~/Downloads/YIMGP2303.DNG | wc 165 1072 12410 .../trunk $ cd ../0.24 .../0.24 $ sudo make install >/dev/null .../0.24 $ exiv2 -pa ~/Downloads/YIMGP2303.DNG | wc 108 517 7691 .../0.24 $v0.24 is almost 3 years ago. Time to move forward.
Updated by Andreas Huggel about 6 years ago
Correct recognition of makernotes for this camera model was added with issue #965 in v0.25. The sample image makes for a good regression test to check if these makernote tags can also be written, thanks. I'll check that in a moment.
Updated by Robin Mills almost 6 years ago
- % Done changed from 0 to 100
- Estimated time set to 4.00 h