I’m slowly learning come command line image processing with ImageMagick and I finally figured out how to ouput a “normal” looking tiff from dcraw. (Using the -w option) [Still haven’t figured out how to do it through IM, I just call dcraw directly]
Anyway, that’s all very nice to convert 1 raw file, but I need to convert a whole folder full! How do select more than one file to send to dcraw? The * operater doesn’t work with dcraw.
The wildcard * is a bash shell glob, it won’t work in the windows does shell.
Also beware, the does shell has a maximum character limit. I have several bat scripts at work that use imagemagick on win 7, and I generally hit that max length limit when processing between 10 - 20 files at a time
Thanks, I basically got all of that, but I take it that Windows doesn’t work the same as Linux, because dcraw says “Invalid argument” when I try the *.
@paperdigits, I haven’t gotten so far as writing bat scripts yet. Is it very difficult?
Is there no “simple” way to process a whole folder of .PEF files? I wish I knew how to call dcraw through IM, because I do know how to do a whole folder with IM!
Hey, thanks a lot! I finally figured it out with help from the stackoverflow thread that @heckflosse linked to. It probably took me half an hour, because I had no idea what the correct syntax was to make dcraw and the FOR command work with each other. Just for future reference, the command that worked for me is:
for %f in (*) do dcraw -w -W -T -6 %f
(That’s what I typed right into the command line, I didn’t actually make a bat file)
I’m really glad to find out that there IS a way to make dcraw see more than one file, even if it has to be slightly complicated.
Note that technically dcraw is still only seeing one file at a time, your shell is making a list of files and passing them one at a time to dcraw.
Also * is shorthand for everything, so if there are other files dcraw can’t do anything with, such as an xmp or jpeg, in the folder, dcraw will probably complain. @patdavid’s *.pef is shorthand for all pef files.
Now I have another question… Is it possible to set the filename for the files that dcraw outputs?
It defaults to the same name as the original .PEF file, but I want to rename them to something else, like converted_raw. I found the -O switch which works for 1 file, but when used with the FOR loop, it just overwrites the file with the same name over and over again, instead of creating a new one.
Thanks, that was a step in the right direction! That appends “converted” to the front of the original filename. I guess that would do the trick, but it’s still sort of messy…
Oops, I just realized that it keeps the .PEF file extension too. So that’s not really a workable solution, the extension is supposed to be .tiff
EDIT: I found a command that works!
for %f in (*.PEF) do dcraw -w -W -T -6 -O converted_%~nf.tif %f
Well, I’m not really looking for anything fancy, just something as simple as hugin’s method.
(Set the name you want, [like “converted” for example] and hugin will use that as a prefix and append a number at the end, instead of overwriting the same file over and over.
In hugin I do it like this: -a aligned_ and it names files like this:
ImageMagick/GraphicsMagick cannot decode and demosaic raw files. Technically if you compiled IM with dcraw/ufraw support you could, but then you’re still just using dcraw and having IM call it.
The bigger question is why are you doing this in the first place? Knowing how to demosaic raw files using dcraw for the sake of knowing is fine, but if you want to get actual photos, why do this? Rather use RawTherapee (it can be used from command-line) to take advantage of its higher quality raw handling than dcraw’s.