FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 12-03-2008, 03:19 AM
Bob
 
Default batch RAW converters

some time ago when I was mostly a widows user I wrote a nice little
batch script that took as an argument a directory path in-which it
expected to find a ./RAW directory containing the *.CRW raw files from
my old canon camera, then it used dcraw and exiftool to develop the raw
file and copy the exif meta data over to the new file.


This can probably be done with a one liner under linux, can someone help
me convert the functionality of this to an sh or perl script?


Thank you, the windows batch is below.
##################################

@echo off
cls
echo from CRW raws
%~d1
cd
cd %~p1
cd RAW
dir /B *.CRW > raw.txt
copy C:
aw_converters.badpixels ..
:: @echo on

set Sufix1=tiff
::

FOR /f %%a in (raw.txt) do call :de_raw %%a
GOTO SUB_DONE
:de_raw

:: cd ..
IF EXIST "..\%~n1.%Sufix1%" GOTO :EOF
echo use dcraw to convert %~nx1 to "%~n1.%Sufix1%"
C:
aw_convertersdcraw.exe -T -v -w -B 2 4 "%~n1.CRW"
:: C:
aw_convertersdcraw.exe -T -v -w -K "C:
aw_convertersdark.pgm"
"%~n1.CRW"
:: worst for some reason

::
echo use exiftool to copy all meta data from %~nx1 to "%~n1.%Sufix1%"
C:
aw_convertersexiftool.exe -TagsFromFile "%~n1.CRW" "%~n1.%Sufix1%"
::
::
echo del "%~n1.%Sufix1%_original"
del "%~n1.%Sufix1%_original"
echo move "%~n1.%Sufix1%" to ..
move "%~n1.%Sufix1%" ..
:: cd RAW
GOTO :EOF
:SUB_DONE

del raw.txt
del ...badpixels
:: http://www.sno.phy.queensu.ca/~phil/exiftool/exiftool_pod.html
::


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 12-03-2008, 06:58 AM
"Owen Townend"
 
Default batch RAW converters

2008/12/3 Bob <spam@homeurl.co.uk>:
> some time ago when I was mostly a widows user I wrote a nice little batch
> script that took as an argument a directory path in-which it expected to
> find a ./RAW directory containing the *.CRW raw files from my old canon
> camera, then it used dcraw and exiftool to develop the raw file and copy the
> exif meta data over to the new file.
>
> This can probably be done with a one liner under linux, can someone help me
> convert the functionality of this to an sh or perl script?
>
> Thank you, the windows batch is below.
> ##################################
>
> @echo off
> cls
> echo from CRW raws
> %~d1
> cd
> cd %~p1
> cd RAW
> dir /B *.CRW > raw.txt
> copy C:
aw_converters.badpixels ..
> :: @echo on
>
> set Sufix1=tiff
> ::
>
> FOR /f %%a in (raw.txt) do call :de_raw %%a
> GOTO SUB_DONE :de_raw
> :: cd ..
> IF EXIST "..\%~n1.%Sufix1%" GOTO :EOF echo use dcraw to convert %~nx1 to
> "%~n1.%Sufix1%"
> C:
aw_convertersdcraw.exe -T -v -w -B 2 4 "%~n1.CRW" ::
> C:
aw_convertersdcraw.exe -T -v -w -K "C:
aw_convertersdark.pgm"
> "%~n1.CRW" :: worst for some reason
> ::
> echo use exiftool to copy all meta data from %~nx1 to "%~n1.%Sufix1%"
> C:
aw_convertersexiftool.exe -TagsFromFile "%~n1.CRW" "%~n1.%Sufix1%"
> ::
> ::
> echo del "%~n1.%Sufix1%_original"
> del "%~n1.%Sufix1%_original"
> echo move "%~n1.%Sufix1%" to ..
> move "%~n1.%Sufix1%" ..
> :: cd RAW
> GOTO :EOF :SUB_DONE
> del raw.txt
> del ...badpixels
> :: http://www.sno.phy.queensu.ca/~phil/exiftool/exiftool_pod.html
> ::
>
>
> --
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject
> of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
>
>

hey hey,
Here's a skeleton to get you started, at least something to work with.
I don't work with crw/raw and haven't seen a .bat script in a
while... but this should help
If you have questions about the linux vs windows differences just ask!

cheers,
Owen.

###################################

#!/bin/bash

RAWDIR="$1"
BADPIXELS="/home/bob/.badpixels"
INSUFFIX="CRW"
OUTSUFFIX="tiff"

DCRAW="/usr/bin/dcraw"
EXIFTOOL="/usr/bin/exiftool"

usage() {
echo "Usage: $0 <dir>"
exit 1;
}

do_dcraw(){
## N.B. the -B option doesn't seem to exist in the version I checked...
${DCRAW} -T -v -w -B 2 4 "$1"
}

do_exiftool(){
${EXIFTOOL} -TagsFromFile "$1" "$2"
}

do_convert() {
local FILENAME="$1"
local BASENAME=`basename ${FILENAME} .${INSUFFIX}`
do_dcraw ${FILENAME}
do_exiftool ${FILENAME} ${BASENAME}.${OUTSUFFIX}
}

## A quick argument check
if ( [ $# -ne 1 ] || # Only one argument
[ ! -d $1 ] ) # The argument exists and is a directory
then usage
fi

## Crawl the given dir and do the actual conversion
find $RAWDIR -name "*.${INSUFFIX}" -execdir do_convert '{}' ;

exit 0;


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 

Thread Tools




All times are GMT. The time now is 06:01 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org