Camera Hacker


Add Comment | Related Links | TrackBack
Related Content

Question re: PPM conversion from an imaging scientist

Hello, Chieh

First, my compliments and thanks for your generosity in sharing your work with dcraw.

I'm an imaging scientist and inventor working on a radically new image enhancement technology that emulates the human visual system. I'm getting amazing results with stills, and will be testing cinema imagery when I have a reasonably fast batch system. But I have a data format problem that I hope you can help solve.

I'm working with Visual Studio under Windows, and cannot easily im/export 16-bit depth imagery into the development environment. I've needed but haven't found a DLL or ActiveX that converts 48-bit TIFF into an integer array in the code environment. I'm told this is so because Windows doesn't support 16-bit graphics. Adobe and others that do true 16-bit editing create their own custom modules, which is beyond the scope of my work.

So I wrote routines to i/o 48-bit binary PPM into/from the code environment. But I can't find a TIFF or PNG two-way batch converter for PPM that doesn't strip the lower 8-bits. Many utilities state they convert TIFF/PPM (e.g. Irfanview) but do not retain 16-bit depth and/or do not convert to/from 48-bit PPM.

I thought dcraw might do this, but could not get from their (or your) documentation that it can be used as a command-line converter both ways between 48-bit TIFF/PPM. Can in fact dcraw convert 48-bit TIFF/PPM both ways?

Specifically, what I need is either/both:

(1) a Windows DLL or ActiveX that translate an integer array in the Visual Studio IDE into/from a 48-bit TIFF file.

(2) a Windows DLL, ActiveX, or command line executable (like dcraw) which can be shelled to convert between 48-bit TIFF and 48-bit PPM files.

Chieh, any info you can provide on this frustrating matter will be most gratefully appreciated.

Richard Knapp
Sat, 13 Jan 2007 01:38:49 -0800


As far as I can tell, dcraw will only output PPM and will not output any other format. You might want to look into ImageMagick. Although it does everything in 8-bit by default, you can recompile it to use 16-bit color depth. See "16-BIT Imaging" in the ImageMagick-3.6.5 README.

Chieh Cheng
Mon, 15 Jan 2007 16:46:41 -0800

Take a look at FreeImage ( It is very easy to use/modify and compiles for VS (I don't remmber what version). It has support for TIFF, PNG, PPM, etc., as well as almost any other format that you can imagine. Ha! 2007, a little late, but should anyone else come along...

Sat, 17 Jan 2009 03:57:23 +0000

As a last resort you could probably do it in Matlab which you can call from VB. Since you are in academia it is a little cheaper to get than for regular folks. With the regular version of matlab, you can call it from vb and then pass the array back in to your program. With the matlab com development kit you can actually build com wrappers that encapsulate all Matlab functionalities and then load the COM natively w/in VB. This lets you call any Matlab code you;ve written and run it on any system even ones that don't have matlab installed. Just a thought, but Matlab can do some crazy image processing pretty fast so it might be worth your time to figure it out if nothing else is working. Good luck.


Tim Brown
Thu, 09 Jul 2009 03:59:25 +0000

The latest version of dcraw can export to TIFF.

Chieh Cheng
Fri, 10 Jul 2009 03:51:35 +0000

Add Comment | Related Links | TrackBack
Related Content

Did your message disappear? Read the Forums FAQ.

Add Comment

Spam Control | * indicates required field
Your Name: *
Remember Me!
Comment: *
File attachment is optional. Please do not attach a file to your submission unless it is relevent.
Attach File:
(20 MB Max)
Spam Protection: * Answer of 6 + 0?
Click button only once, please!


TrackBack only accepted from WebSite-X Suite web sites. Do not submit TrackBacks from other sites.

Send Ping | TrackBack URL | Spam Control

No TrackBacks yet. TrackBack can be used to link this thread to your weblog, or link your weblog to this thread. In addition, TrackBack can be used as a form of remote commenting. Rather than posting the comment directly on this thread, you can posts it on your own weblog. Then have your weblog sends a TrackBack ping to the TrackBack URL, so that your post would show up here.

Messages, files, and images copyright by respective owners.