TIFF to DNG conversion?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
crowtato
Posts: 4
Joined: 2014-07-22T10:29:28-07:00
Authentication code: 6789

TIFF to DNG conversion?

Post by crowtato »

I'm looking for a way to convert TIFFs to linear DNGs in ImageMagick/dcraw (for archival purposes--it saves a lot of space).

So far, Lightroom and Photoshop (and maybe DxO) seem like the only things that can convert non-raw images to DNG, so just wondering if anyone here has been able to do that with dcraw or something else? (...e.g., with Adobe's dng_validate.exe or maybe a brilliant mod in their DNG SDK? wishful thinking?)

If that's familiar territory for anyone, I'm all ears...Thanks for any wisdom!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: TIFF to DNG conversion?

Post by snibgo »

Neither IM or dcraw can write DNG. Nor Gimp. Nor any other open-source software that I'm aware of.
snibgo's IM pages: im.snibgo.com
crowtato
Posts: 4
Joined: 2014-07-22T10:29:28-07:00
Authentication code: 6789

Re: TIFF to DNG conversion?

Post by crowtato »

Bummer! Thanks anyway, snibgo.

If something does come along, would love to hear about it. maybe even CinemaDNG-conversion tools-in-development, just in case there's overlap in the video-world...

(otherwise, randomly came across a pretty thorough list here: http://www.barrypearson.co.uk/articles/ ... converters ...but it's been frozen as of 2011)
starfry
Posts: 11
Joined: 2015-07-18T16:47:36-07:00
Authentication code: 1151

Re: TIFF to DNG conversion?

Post by starfry »

Is this still the case in 2018 ?

(I hope it's ok to bump an old qestion but this is exactly what I wanted to ask...)
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: TIFF to DNG conversion?

Post by snibgo »

No problem re-asking an old question. Sorry, but my answer is unchanged.

You might like to ask the question at https://discuss.pixls.us/ . Many folk there have more knowledge than me about developments in open-source image processing, and may know something useful, or the question might spur someone into action.
snibgo's IM pages: im.snibgo.com
starfry
Posts: 11
Joined: 2015-07-18T16:47:36-07:00
Authentication code: 1151

Re: TIFF to DNG conversion?

Post by starfry »

Thanks for the reply :) I only discovered that forum the other day as it happens, I'll have to sign up there and see if I can get more info.

I've been trying to line things up for a scanning workflow which archives to linear DNG but hit so many roadblocks that I feel it might be not worth the bother, but instead stick with linear TIFFs. DNG seems to be so inconsistently supported that I am starting to struggle to see its purpose.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: TIFF to DNG conversion?

Post by snibgo »

In my view, DNG is or was potentially useful as a vendor-neutral raw file format, ie Bayer images from cameras. If takeup had been better, it might also have encouraged vendors like Nikon and Canon to move away from proprietary formats. (Yeah, I know, fat chance.)

Some Adobe software can convert proprietary raw to DNG. I forget the name. It is free (as in free beer) but closed source. I don't know if it captures all the details from the proprietary raw. (If it doesn't, it's useless.)
snibgo's IM pages: im.snibgo.com
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: TIFF to DNG conversion?

Post by Bonzo »

As far as I can remember there are a few DNG converters around when I was looking five or so years ago. I believe there is also a DNG API but I could not understand how to implement it.

DNG is being touted by Adobe as they say DNG will stay whereas proprietary RAW formats may die.

There is one good thing about DNG files and that is you can add meta data. You can force meta data into RAW formats but most of them were not designed to accept it; which seems stupid to me.

EDIT: Adobe DNG Software Development Kit (SDK)
starfry
Posts: 11
Joined: 2015-07-18T16:47:36-07:00
Authentication code: 1151

Re: TIFF to DNG conversion?

Post by starfry »

Just in case anyone really wants to do this... there is a way to convert TIFF to DNG (and, also DNG to TIFF but there are other ways to do that).

If you have the professional edition of VueScan then you can "scan" a file (a TIFF or DNG) and save the resulting scan as either a TIFF or a DNG. So... you can "scan" a TIFF and save raw DNG.

VueScan is not free software, unfortunately.
crowtato
Posts: 4
Joined: 2014-07-22T10:29:28-07:00
Authentication code: 6789

Re: TIFF to DNG conversion?

Post by crowtato »

Thanks for updates, starfry & co!
For a few archival workflows restricted to using linear DNG, I've been sticking with Lightroom for batch converting TIFF --> DNG.

If Lightroom [or VueScan] doesn't fit your bill, though, here are a couple other things that also turned up:

- Sandy/Alexander McGuffog's 'toDNG' might be worth a look ( https://sites.google.com/site/todngsite/ ). It's mac-only, but built specifically for converting bitmap/jpg/tiff to dng, and Sandy was pretty responsive to some questions a few years ago.

- The forum snigbo recommended looks promising -- from this thread ( https://discuss.pixls.us/t/zeronoise-li ... ow/3022/18 --> http://rawpedia.rawtherapee.com/Film_Si ... entity_DNG ), here might be a promising exiftool command that partly converts a TIFF to a DNG (or at least rewrites a TIFF's metadata to make it walk/talk like a DNG...but not quite a valid DNG):

Code: Select all

     
     exiftool -DNGVersion=1.4.0.0 -PhotometricInterpretation='Linear Raw' image_to_dng.tif
     mv -v image_to_dng.tif shinyNewDNG.dng  # or your preferred method to change the file's extension to ".dng"
...The output DNG I got from that seemed ok at first (previewed ok in windows file browser), but no luck opening it in Lr or Ps nor was there a major filesize difference between it and the tif-input. I'd be kinda surprised if exiftool alone could do more than edit the metadata (since that's its main purpose) -- but if the main/key difference between Linear DNG & TIFF is in the metadata/file header, maybe not an insignificant piece.

From there, maybe just [ha] a matter of figuring out the right imagemagick commands &/or fiddling with the right pieces of the DNG-SDK to accomplish a similar kind of lossless compression as whatever Lightroom does--maybe VueScan, too?

& for info-purposes: Lightroom [losslessly] cuts the filesize of a TIF in half when converting it to a linear DNG. On average a ~30MB TIF (8bit, no layers) goes down to a 15MB linear DNG (no JPG preview, no lossy compression). Am keen to understand how/why, if anyone has details...
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: TIFF to DNG conversion?

Post by snibgo »

crowtato wrote:On average a ~30MB TIF (8bit, no layers) goes down to a 15MB linear DNG (no JPG preview, no lossy compression). Am keen to understand how/why, if anyone has details...
I have no specific details (I don't use Lightroom), but I advise caution. The compression may be due to the posterization effect of linearizing at 8-bit.

The 8-bit input has values 0-255. Assuming gamma=2.2, then linearising means that the bottom (shadow) 15 values all become zero. The bottom 52 values become crammed into just 8 values. Overall, the 256 possible input values are reduced to 184 possible output values. This posterization will be visually evident if you ever de-linearize the image.

Of course for some purposes this posterization may not matter.
snibgo's IM pages: im.snibgo.com
Post Reply