Page 1 of 1

Read files that have an .xxx extension as if they were .yyy files

Posted: 2017-12-01T03:48:16-07:00
by DanWoods
Hi All,

First time poster, I recently discovered IM and am pretty impressed, wished I knew about it long ago!

The task I'm undertaking is copy/converting a folder full of headerless 16-bit grayscale image files into 8-bit Multipage TIFFs on the Windows command line. The process is to be repeated multiple times on many large folders (one TIFF per folder) so I want it to be as efficient as possible.

The issue is that the files have a .RAW file extension and I couldn't find a way to make IM realise that these were actually RAW data (just pixels) and not Canon Raw (unprocessed) files. I solved this by copying the files to a temporary folder and using the .gray extension.

So the process for each folder is currently:

Code: Select all

XCOPY  %InputFolder%\*.raw  %_TemporaryFolder%\*.gray
MAGICK -size %%L  %_TemporaryFolder%\*.gray -depth 8 %_OutputFolder%\OutputFile.tif"
What I'd prefer, however, is simply to work straight off the .RAW files and skip the intermediate step in which I copy a few 100 MB into a temp folder. Something like:

MAGICK -FileFormat GRAY -size %%L %CurrentFolder%\*.raw -depth 8 %_OutputFolder%\OutputFile.tif"

But I can't find any option for this. What am I missing?

Dan

Re: Read files that have an .xxx extension as if they were .yyy files

Posted: 2017-12-01T04:21:12-07:00
by DanWoods
OK, so as usually happens to me, writing about the problem helped me describe it better and helped me formulate a Google search that got results.

This is my answer using the gray: prefix for the file with the wrong extension.

Code: Select all

MAGICK -size %%L  gray:%InputFolder%\*.raw -depth 8 %_OutputFolder%\OutputFile.tif"
If anyone else has a bright idea or a load of criticism for how I'm doing this, go ahead and post it below.

Link to my source:
https://www.imagemagick.org/discourse-s ... hp?t=15554

Re: Read files that have an .xxx extension as if they were .yyy files

Posted: 2017-12-01T04:46:06-07:00
by snibgo
Yes, the prefix "gray:" is needed.

If you need maximum speed, I think IM Q8 can read 16-bit files, and will write only 8-bit files, but will be slightly faster than Q16. But not much faster, maybe 5% or something.

Re: Read files that have an .xxx extension as if they were .yyy files

Posted: 2017-12-01T07:32:01-07:00
by DanWoods
Thanks for the tip, I've swapped versions. Good to know.