I have a proprietary raw camera image format taken from a Aptina camera.

Its raw file format is 16bit per color channel, 'GRBG' mode with file extension .raw. No headers, nothing, just plan raw bayer samples. I want to convert this format to DNG, as none of the raw image decoders (dcraw, gimp, …) seem to support it.

  1. Is there any tool/converter which can handle Aptina camera sensor raw bayer format, and allow me to convert it to DNG format?

  2. If not, I want to write a small C code to convert it myself. Where can I find the detailed specification about DNG format, its structure etc.? Any document explaining all this DNG format?

  • crossposting? stackoverflow.com/questions/4618099/…
    – asalamon74
    Jan 6, 2011 at 19:20
  • 2
    Another alternative, if you're writing C code, would be to extend dcraw to support the simple Aptina raw format. That'd save you the bother of the intermediate step, and if you contribute the patch back upstream, then after a little while every program which bases its raw input code on dcraw will magically work too.
    – mattdm
    Jan 7, 2011 at 0:31

4 Answers 4


DNG files are based on the TIFF/EP standard, ISO 12234-2, (they're essentially bitmaps with extra metadata) so if you start out with an appropriate TIFF I/O library that will get you part way, but you'll need to fill in the extra data required by DNG, which could be tricky.

Raw converters need to know more than just the pixel intensities. Other relevant information includes pixel shape and orientation, or the properties of the dyes (just knowing they go GRBG is not enough, you may need to know the precise shade (or more accurately the frequency response) of each dye to create the colour representation as this varies between manufacturers). I think DNGs handle this by means of an embedded "camera profile".


There's an open source photo management application called digiKam which can write DNG files, so your best bet would probably be to look through their source and try and rip out the DNG encoding functions.

  • But digikam does not support opening of this particular raw file. Tried that.
    – goldenmean
    Jan 7, 2011 at 12:26
  • What I meant was to modify the digiKam code and insert your own raw data prior to writing a DNG, not to try and load your Raws directly. Anyway this was before I knew there was an SDK from Adobe, this will be your best bet.
    – Matt Grum
    Jan 7, 2011 at 14:22

The DNG documentation is freely available from Adobe and they include an SDK, though I haven't checked the SDK for language options, very likely something like C or C++, but you never know these days... :)

In any case, the specification is open and freely usable.

  • 1
    The Adobe DNG SDK is clearly the best way to go!
    – Matt Grum
    Jan 6, 2011 at 20:40
  • 1
    Yeah, I've read the spec a few times because there's a lot of misinformation around the format, but I haven't poked at the SDK to be certain about it. I like the idea of it too, fortunately my camera is one of the ones that does it natively so reading it for interest sake is all that I needed to do. :)
    – Joanne C
    Jan 6, 2011 at 21:55
  • Just curious about which Camera make do you have which does support DNG format?
    – goldenmean
    Apr 27, 2011 at 10:36
  • @goldenmean - I shoot Pentax, they've had in-camera DNG support since the K10D.
    – Joanne C
    Apr 27, 2011 at 10:51

If you are up for it, Aptina provides documentation of many aspects of the products, (I think) intended for manufacturers of add-ons. But if you sign an NDA you can get access to the documentation library, where presumably you can learn what you need to write code yourself. See their FAQ.


Adobe have a free utility that converts from about 350 different RAW file formats to DNG.

Link for Windows version

Link for Mac version

It may be worth giving it a go?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.