Remove IFD0 images from DNG

Started by Elliott B, March 28, 2013, 03:37:38 AM

Previous topic - Next topic

Elliott B

I'd like to remove the thumbnails and previews from DNG files from a Nikon V1.
The following command gives: Warning: [minor] Can't delete IFD0 from DNG - 000001.dng
exiftool -ifd0:all= 000001.dng

This command successfully removes the preview, but I can't figure out how to delete the 256x171 TIFF thumbnail.
exiftool -previewimage= 000001.dng

Elliott B

After looking at the verbose output, I realize that IFD0 includes everything, so it makes sense that it can't be deleted.  The thumbnail appears to be the primary or "default" Subfile.  There is a SubIFD (SubDirectory) inside IFD0, which shows the full-res info.  So maybe the trick is to replace the main Subfile with that of the SubIFD, then delete the SubIFD?  I don't know if that's possible.
I should probably mention, the ultimate goal is to open these files in DaVinci Resolve, which can only see the primary Subfile.

  ExifToolVersion = 9.24
  FileName = 000001.dng
  Directory = .
  FileSize = 8928024
  FileModifyDate = 1364455349
  FileAccessDate = 1364455349
  FileInodeChangeDate = 1364455349
  FilePermissions = 33261
  FileType = DNG
  MIMEType = image/x-adobe-dng
  ExifByteOrder = II
  + [IFD0 directory with 60 entries]
  | 0)  SubfileType = 1
  | 1)  ImageWidth = 256
  | 2)  ImageHeight = 171
  | 3)  BitsPerSample = 8 8 8
  | 4)  Compression = 1
  | 5)  PhotometricInterpretation = 2
  | 6)  Make = NIKON CORPORATION
  | 7)  Model = NIKON 1 V1
  | 8)  StripOffsets = 8796696
  | 9)  Orientation = 1
  | 10) SamplesPerPixel = 3
  | 11) RowsPerStrip = 171
  | 12) StripByteCounts = 131328
  | 13) PlanarConfiguration = 1
  | 14) Software = Adobe DNG Converter 7.3 (Windows)
  | 15) ModifyDate = 2013:03:24 09:08:55
  | 16) SubIFD (SubDirectory) -->
  | + [SubIFD directory with 28 entries]
  | | 0)  SubfileType = 0
  | | 1)  ImageWidth = 3904
  | | 2)  ImageHeight = 2604
  | | 3)  BitsPerSample = 16
  | | 4)  Compression = 7
  | | 5)  PhotometricInterpretation = 32803
  | | 6)  SamplesPerPixel = 1
  | | 7)  PlanarConfiguration = 1
  | | 8)  TileWidth = 256
  | | 9)  TileLength = 240
  | | 10) TileOffsets = 152326 204758 256530 308782 360998 412962 464906 517118 569646 [snip]
  | | 11) TileByteCounts = 52431 51771 52252 52216 51963 51944 52211 52527 52515 52734 [snip]
  | | 12) CFARepeatPatternDim = 2 2
  | | 13) CFAPattern2 = 0 1 1 2
  | | 14) CFAPlaneColor = 0 1 2
  | | 15) CFALayout = 1
  | | 16) LinearizationTable = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 [snip]
  | | 17) BlackLevelRepeatDim = 1 1
  | | 18) BlackLevel = 0 (0/256)
  | | 19) WhiteLevel = 4095
  | | 20) DefaultScale = 1 1 (1/1 1/1)
  | | 21) DefaultCropOrigin = 12 6 (12/1 6/1)
  | | 22) DefaultCropSize = 3872 2592 (3872/1 2592/1)
  | | 23) BayerGreenSplit = 500
  | | 24) AntiAliasStrength = 1 (100/100)
  | | 25) BestQualityScale = 1 (1/1)
  | | 26) ActiveArea = 0 0 2604 3904
  | | 27) DefaultUserCrop = 0 0 1 1 (0/1 0/1 1/1 1/1)
  | 17) ApplicationNotes (SubDirectory) -->
  | + [XMP directory, 6033 bytes]
  | | XMPToolkit = Adobe XMP Core 5.5-c002 1.148022, 2012/07/15-18:06:45       
  | | CreatorTool = Adobe DNG Converter 7.3 (Windows)
  | | ModifyDate = 2013-03-24T09:08:55Z
  | | CreateDate = 2013-03-24T09:01:33.00
  | | MetadataDate = 2013-03-24T09:08:55Z
  | | SerialNumber = 61047278
  | | LensInfo = 100/10 300/10 35/10 56/10
  | | Lens = 1 NIKKOR VR 10-30mm f/3.5-5.6
  | | ImageNumber = 304
  | | ApproximateFocusDistance = 30/100
  | | DateCreated = 2013-03-24T09:01:33.00
  | | DocumentID = xmp.did:402ff781-dceb-3449-9d2e-c32f4fc0e31f
  | | OriginalDocumentID = AC1780B439E94ADEB291E6C1256476A4
  | | InstanceID = xmp.iid:402ff781-dceb-3449-9d2e-c32f4fc0e31f
  | | Format = image/dng
  | | HistoryAction = derived
  | | HistoryParameters = converted from image/x-nikon-nef to image/dng, saved to new l[snip]
  | | HistoryAction = saved
  | | HistoryInstanceID = xmp.iid:402ff781-dceb-3449-9d2e-c32f4fc0e31f
  | | HistoryWhen = 2013-03-24T09:08:55Z
  | | HistorySoftwareAgent = Adobe DNG Converter 7.3 (Windows)
  | | HistoryChanged = /
  | | DerivedFromDocumentID = AC1780B439E94ADEB291E6C1256476A4
  | | DerivedFromOriginalDocumentID = AC1780B439E94ADEB291E6C1256476A4
  | 18) ExifOffset (SubDirectory) -->
  | + [ExifIFD directory with 35 entries]
  | | 0)  ExposureTime = 0.01666666667 (1/60)
  | | 1)  FNumber = 3.5 (35/10)
  | | 2)  ExposureProgram = 2
  | | 3)  ISO = 3200
  | | 4)  SensitivityType = 2
  | | 5)  ExifVersion = 0230
  | | 6)  DateTimeOriginal = 2013:03:24 09:01:33
  | | 7)  CreateDate = 2013:03:24 09:01:33
  | | 8)  ShutterSpeedValue = 5.906891 (5906891/1000000)
  | | 9)  ApertureValue = 3.61471 (361471/100000)
  | | 10) ExposureCompensation = 0 (0/6)
  | | 11) MaxApertureValue = 3.6 (36/10)
  | | 12) MeteringMode = 5
  | | 13) LightSource = 0
  | | 14) Flash = 0
  | | 15) FocalLength = 10 (100/10)
  | | 16) SubSecTimeOriginal = 00
  | | 17) SubSecTimeDigitized = 00
  | | 18) SensingMethod = 2
  | | 19) FileSource = 3
  | | 20) SceneType = 1
  | | 21) CustomRendered = 0
  | | 22) ExposureMode = 0
  | | 23) WhiteBalance = 0
  | | 24) DigitalZoomRatio = 1 (1/1)
  | | 25) FocalLengthIn35mmFormat = 27
  | | 26) SceneCaptureType = 0
  | | 27) GainControl = 2
  | | 28) Contrast = 0
  | | 29) Saturation = 0
  | | 30) Sharpness = 0
  | | 31) SubjectDistanceRange = 0
  | | 32) SerialNumber = 61047278
  | | 33) LensInfo = 10 30 3.5 5.6 (100/10 300/10 35/10 56/10)
  | | 34) LensModel = 1 NIKKOR VR 10-30mm f/3.5-5.6
  | 19) ImageNumber = 304
  | 20) DNGVersion = 1 3 0 0
  | 21) DNGBackwardVersion = 1 1 0 0
  | 22) UniqueCameraModel = Nikon 1 V1
  | 23) ColorMatrix1 = 0.9398 -0.351 0.018 -0.375 1.0884 0.3311 -0.0022 0.0872 0.6669 ([snip]
  | 24) ColorMatrix2 = 0.8994 -0.2667 -0.0865 -0.4594 1.2324 0.2552 -0.0699 0.1786 0.62[snip]
  | 25) CameraCalibration1 = 1 0 0 0 1 0 0 0 1 (10000/10000 0/10000 0/10000 0/10000 100[snip]
  | 26) CameraCalibration2 = 1 0 0 0 1 0 0 0 1 (10000/10000 0/10000 0/10000 0/10000 100[snip]
  | 27) AnalogBalance = 1 1 1 (1000000/1000000 1000000/1000000 1000000/1000000)
  | 28) AsShotNeutral = 0.641604 1 0.506931 (641604/1000000 1000000/1000000 506931/1000000)
  | 29) BaselineExposure = 0.35 (35/100)
  | 30) BaselineNoise = 2 (200/100)
  | 31) BaselineSharpness = 1.25 (125/100)
  | 32) LinearResponseLimit = 1 (100/100)
  | 33) CameraSerialNumber = 61047278
  | 34) DNGLensInfo = 10 30 3.5 5.6 (100/10 300/10 35/10 56/10)
  | 35) ShadowScale = 1 (1/1)
  | 36) DNGAdobeData (SubDirectory) -->
  | + [DNGAdobeData directory, 20534 bytes]
  | | MakN = II. Nikon..II*.1...0210........Z....b....p....x...........................[snip]
  | | + [AdobeMakN directory, 20520 bytes]
  | | | + [MakerNotes directory with 49 entries]
  | | | | 0)  MakerNoteVersion = 0210
  | | | | 1)  ISO = 0 3200
  | | | | 2)  Quality = RAW   
  | | | | 3)  WhiteBalance = AUTO       
  | | | | 4)  FocusMode = AF-S 
  | | | | 5)  FlashSetting =             
  | | | | 6)  FlashType =                   
  | | | | 7)  WhiteBalanceFineTune = 0 0
  | | | | 8)  WB_RBLevels = 1.55859375 1.97265625 1 1 (399/256 505/256 256/256 256/256)
  | | | | 9)  ProgramShift = ..
  | | | | 10) ExposureDifference = ...
  | | | | 11) PreviewIFD (SubDirectory) -->
  | | | | + [PreviewIFD directory with 7 entries]
  | | | | | 0)  Compression = 6
  | | | | | 1)  XResolution = 300 (300/1)
  | | | | | 2)  YResolution = 300 (300/1)
  | | | | | 3)  ResolutionUnit = 2
  | | | | | 4)  PreviewImageStart = 20504
  | | | | | 5)  PreviewImageLength = 0
  | | | | | 6)  YCbCrPositioning = 2
  | | | | 12) FlashExposureComp = ..
  | | | | 13) ExternalFlashExposureComp = ..
  | | | | 14) CropHiSpeed = 0 3904 2606 3904 2606 0 0
  | | | | 15) SerialNumber = 61047278
  | | | | 16) ColorSpace = 1
  | | | | 17) VRInfo (SubDirectory) -->
  | | | | + [BinaryData directory, 8 bytes]
  | | | | | VRInfoVersion = 0101
  | | | | | VibrationReduction = 1
  | | | | 18) ActiveD-Lighting = 65535
  | | | | 19) PictureControlData (SubDirectory) -->
  | | | | + [BinaryData directory, 58 bytes]
  | | | | | PictureControlVersion = 0100
  | | | | | PictureControlName = VIVID
  | | | | | PictureControlBase = VIVID
  | | | | | PictureControlAdjust = 0
  | | | | | PictureControlQuickAdjust = 128
  | | | | | Sharpness = 132
  | | | | | Contrast = 128
  | | | | | Brightness = 128
  | | | | | Saturation = 128
  | | | | | HueAdjustment = 128
  | | | | | FilterEffect = 255
  | | | | | ToningEffect = 255
  | | | | | ToningSaturation = 255
  | | | | 20) WorldTime (SubDirectory) -->
  | | | | + [BinaryData directory, 4 bytes]
  | | | | | Timezone = 0
  | | | | | DaylightSavings = 1
  | | | | | DateDisplayFormat = 2
  | | | | 21) ISOInfo (SubDirectory) -->
  | | | | + [BinaryData directory, 14 bytes]
  | | | | | ISO = 120
  | | | | | ISOExpansion = 0
  | | | | | ISO2 = 120
  | | | | | ISOExpansion2 = 0
  | | | | 22) UnknownInfo (SubDirectory) -->
  | | | | + [BinaryData directory, 94 bytes]
  | | | | 23) Nikon_0x002d = 512 0 0
  | | | | 24) UnknownInfo2 (SubDirectory) -->
  | | | | + [BinaryData directory, 8 bytes]
  | | | | 25) Nikon_0x0034 = 34
  | | | | 26) Nikon_0x0037 = 0
  | | | | 27) LensType = 24
  | | | | 28) Lens = 10 30 3.5 5.6 (100/10 300/10 35/10 56/10)
  | | | | 29) FlashMode = 0
  | | | | 30) ShootingMode = 33
  | | | | 31) Nikon_0x008a = 3
  | | | | 32) LensFStops = h..
  | | | | 33) ContrastCurve = I0
  | | | | 34) ShotInfoUnknown (SubDirectory) -->
  | | | | + [BinaryData directory, 16780 bytes]
  | | | | | ShotInfoVersion = 0400
  | | | | | FirmwareVersion = <...*
  | | | | 35) NEFCompression = 4
  | | | | 36) NoiseReduction = OFF
  | | | | 37) NEFLinearizationTable = D H.H.H.H.... 0@P`p......A.q.......L.......b.....[snip]
  | | | | 38) ColorBalanceUnknown = 0400...A-.7.G.,.'.j z......!ivX.Oy.%........W...F.C[snip]
  | | | | 39) LensDataUnknown (SubDirectory) -->
  | | | | + [BinaryData directory, 590 bytes]
  | | | | | LensDataVersion = 0401
  | | | | 40) RawImageCenter = 1948 1302
  | | | | 41) RetouchHistory = 0 0 0 0 0 0 0 0 0 0
  | | | | 42) Nikon_0x00a4 = 0200
  | | | | 43) ShutterCount = 304
  | | | | 44) FlashInfoUnknown (SubDirectory) -->
  | | | | + [BinaryData directory, 48 bytes]
  | | | | | FlashInfoVersion = 0200
  | | | | 45) VariProgram =               
  | | | | 46) HighISONoiseReduction = 1
  | | | | 47) AFInfo2 (SubDirectory) -->
  | | | | + [BinaryData directory, 42 bytes]
  | | | | | AFInfo2Version = 0200
  | | | | | ContrastDetectAF = 0
  | | | | | AFAreaMode = 129
  | | | | | PhaseDetectAF = 4
  | | | | | PrimaryAFPoint = 0
  | | | | | AFPointsUsed = ..
  | | | | | AFImageWidth = 0
  | | | | | AFImageHeight = 0
  | | | | | AFAreaXPosition = 0
  | | | | | AFAreaYPosition = 0
  | | | | | AFAreaWidth = 0
  | | | | | AFAreaHeight = 0
  | | | | | ContrastDetectAFInFocus = 0
  | | | | 48) AFTune (SubDirectory) -->
  | | | | + [BinaryData directory, 4 bytes]
  | | | | | AFFineTune = 0
  | | | | | AFFineTuneIndex = 255
  | | | | | AFFineTuneAdj = 0
  | 37) CalibrationIlluminant1 = 17
  | 38) CalibrationIlluminant2 = 21
  | 39) RawDataUniqueID = _.=..gy..-A..k..
  | 40) OriginalRawFileName = DSC_0302.NEF
  | 41) CameraCalibrationSig = com.adobe
  | 42) ProfileCalibrationSig = com.adobe
  | 43) ProfileName = Adobe Standard
  | 44) ProfileHueSatMapDims = 90 30 1
  | 45) ProfileHueSatMapData1 = 2 1 1 1.72663879394531 1.01875483989716 1.0008565187454[snip]
  | 46) ProfileHueSatMapData2 = 2 1 1 2.37324857711792 1.00943005084991 0.9978566765785[snip]
  | 47) ProfileEmbedPolicy = 0
  | 48) ProfileCopyright = Copyright 2011 Adobe Systems, Inc.
  | 49) ForwardMatrix1 = 0.7009 0.1771 0.0863 0.2317 0.9052 -0.1369 -0.0737 -0.3488 1.2[snip]
  | 50) ForwardMatrix2 = 0.6493 0.3344 -0.0194 0.2447 1.0332 -0.278 0.0003 -0.1854 1.01[snip]
  | 51) PreviewApplicationName = Adobe DNG Converter
  | 52) PreviewApplicationVersion = 7.3
  | 53) PreviewSettingsDigest = J.....s...=..e./
  | 54) PreviewColorSpace = 2
  | 55) PreviewDateTime = 2013-03-24T09:08:55Z
  | 56) ProfileLookTableDims = 36 8 16
  | 57) ProfileLookTableData = 0 1 1 0 0.87861567735672 1 0 0.885046482086182 1 0 0.892[snip]
  | 58) NoiseProfile = 0.00153129320210575 3.11189980241913e-06 0.00123005722133211 1.6[snip]
  | 59) NewRawImageDigest = ..J.@..c.K[._...

Phil Harvey

ExifTool can not be used to do what you want (move the primary raw image from the SubIFD to IFD0).  I don't think you will have a valid DNG file if you do this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

tfraser

Hello,

Perhaps not a valid DNG file, but a valid CinemaDNG file?  see:

http://www.ikonoskop.com/workflow/

zipped sample I opened, "Autumn1" had only the IFD0 group with full res image in 16bits and it opens and plays/grades great in Davinci Resolve.  (full res image is the only image contained as far as I see)

One can see the exif info using your software, but I can only guess which tags Resolve depends on seeing present.

Having said all this, I have found success in using Nikon ViewNX2 to convert each NEF into a TIFF, and Resolve imports these sequential TIFF files as a movie clip at full res, so maybe that is as good as dealing with raw?  I had thought I had a quality issue with this option until today, when I realised through further testing, that my indoor shots with the Nikon V1 were auto set to iso 3200, hence a bit grainy, and today I took outdoor shots and noticed iso jumped down to 100 and this is giving great results.  (the V1 is fully auto operation in burst mode, unfortunately)

So given these TIFF files are 16bits, (need to double check this), maybe I already have an ideal workflow, avoiding DNG altogether?  Thoughts appreciated.

Tim

Phil Harvey

I think that developing the RAW into a 16-bit TIFF is absolutely the right thing to do.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).