ich wurde von Mika angehalten, doch mal mein Script hier rein zu stellen - also mache ich das mal
Ziel war eigentlich nur meine Raw Files per Batch umzuwandeln, etwas zu justieren und kleiner abzuspeichern. Und möglichst ohne Photoshop und Co.
Zusätzlich lasse ich noch einen Entrauscher drüber laufen, habe von dem 2 Varianten, eine GPU basierte und eine für CPU. Der ist eigentlich für avisynth, also für das Entrauschen von Videos, bringt aber bei Photos aus sehr gute Ergebnisse. Ist nur elend langsam...
Um dunkle Bereiche besser aufhellen zu können, habe ich noch den Reinhard Tonemapper mit ein gebastelt. Würde ohne vielleicht auch gehen, aber ich mag die Ästhetik von dem ganz gerne.
Hier mal 2 Bilder zum Vergleich:
Original-JPG aus Kamera
Bearbeitetes Bild
Farben würden sich natürlich noch anpassen lassen.
Und hier auch das Script (die CPU Version):
- Code: Select all
@echo off
Setlocal EnableDelayedExpansion
if exist web GOTO :raw
mkdir web
:raw
if exist raw GOTO :encode
mkdir raw
:encode
for %%i in ("*.CR2") do (
C:\cmdtools\exiftool -Orientation -S -n %%i >> %%~ni_ori.tmp
for /f "tokens=2* delims= " %%a in (%%~ni_ori.tmp) do (
if %%a== 1 (
echo C:\cmdtools\dcraw +M -w -S 0.2 -v %%i >> "%%~ni.cmd"
echo C:\cmdtools\convert %%~ni.ppm -define quantum:format=floating-point %%~ni.hdr >> "%%~ni.cmd"
echo C:\cmdtools\tonemap %%~ni.hdr %%~ni.ppm -ppm -key:0.72 -white:1e20 -threshold:0.05 -phi:20.0 -num:12 -low:1 -high:43 -gamma:1.0 >> "%%~ni.cmd"
call "%%~ni.cmd"
del "%%~ni.cmd"
del "%%~ni.hdr"
echo LoadPlugin^("C:\Program Files (x86)\AviSynth 2.5\plugins\TNLMeans.dll"^) >> "%%~ni.avs"
echo Import^("C:\Program Files (x86)\AviSynth 2.5\plugins\SeeSaw.avs"^) >> "%%~ni.avs"
echo ImageReader^("%%~ni.ppm",start=1,end=1^) >> "%%~ni.avs"
echo Lanczos4Resize^(1440,960^) >> "%%~ni.avs"
echo function RGB32ToYV12^(clip input^) { >> "%%~ni.avs"
echo input.Crop(0, 0, -^(input.Width %% 2^), -^(input.Height %% 2^)^) >> "%%~ni.avs"
echo ConvertToYV24^(matrix="PC.601"^) >> "%%~ni.avs"
echo YToUV^(UToY8, VToY8, PointResize(last.Width * 2, last.Height * 2^)^) >> "%%~ni.avs"
echo } >> "%%~ni.avs"
echo RGB32ToYV12^(^) >> "%%~ni.avs"
echo TNLMeans^(h=2,ax=5,ay=5,bx=0,by=0,sx=2,sy=2,a=1.0^) >> "%%~ni.avs"
echo dull = last >> "%%~ni.avs"
echo dull.ConvertToYV12^(^)SeeSaw^(NRlimit=0, NRlimit2=5, Sstr=1.5, Szp=1, Slimit=50, Sdamplo=16, Spower=1, sootheT=95, SdampHi=39^) >> "%%~ni.avs"
echo function YV12ToRGB32^(clip input^) { >> "%%~ni.avs"
echo input >> "%%~ni.avs"
echo YToUV^(UToY8, VToY8, PointResize^(last.Width / 2, last.Height / 2^)^) >> "%%~ni.avs"
echo ConvertToRGB32^(matrix="PC.601"^) >> "%%~ni.avs"
echo } >> "%%~ni.avs"
echo YV12ToRGB32^(^) >> "%%~ni.avs"
echo ImageWriter^(file = "%%~ni_tonemap", start = 0, end = 0, type = "ppm"^) >> "%%~ni.avs"
echo C:\cmdtools\avs2avi.exe "%%~ni.avs" -o n -c xvid >> "%%~ni.cmd"
echo del %%~ni.ppm >> "%%~ni.cmd"
echo del %%~ni.avs >> "%%~ni.cmd"
echo ren %%~ni_tonemap000000.ppm "%%~ni_tonemap.ppm" >> "%%~ni.cmd"
echo C:\cmdtools\convert "%%~ni_tonemap.ppm" -color-matrix " 1.1 0.0 0.0 0.0, 0.0, -0.05 0.0 1.1 0.0 0.0, 0.0, -0.05 0.0 0.0 1.14 0.0, 0.0, -0.05 0.0 0.0 0.0 1.0, 0.0, 0.0 0.0 0.0 0.0 0.0, 1.0, 0.0 0.0 0.0 0.0 0.0, 0.0, 1.0" "%%~ni_tonemap.ppm" >> "%%~ni.cmd"
echo C:\cmdtools\convert %%~ni_tonemap.ppm -quality 87 %%~ni_small.jpg >> "%%~ni.cmd"
echo C:\cmdtools\exiftool.exe -tagsFromFile %%i %%~ni_small.jpg >> "%%~ni.cmd"
echo del %%~ni_small.jpg_original >> "%%~ni.cmd"
call "%%~ni.cmd"
del "%%~ni.cmd"
del "%%~ni_tonemap.ppm"
del "%%~ni_ori.tmp"
)
if %%a== 8 (
echo C:\cmdtools\dcraw +M -w -S 0.2 -v %%i >> "%%~ni.cmd"
echo C:\cmdtools\convert %%~ni.ppm -define quantum:format=floating-point %%~ni.hdr >> "%%~ni.cmd"
echo C:\cmdtools\tonemap %%~ni.hdr %%~ni.ppm -ppm -key:0.72 -white:1e20 -threshold:0.05 -phi:20.0 -num:12 -low:1 -high:43 -gamma:1.0 >> "%%~ni.cmd"
echo C:\cmdtools\convert -rotate 90 %%~ni.ppm %%~ni.ppm >> "%%~ni.cmd"
call "%%~ni.cmd"
del "%%~ni.cmd"
del "%%~ni.hdr"
echo LoadPlugin^("C:\Program Files (x86)\AviSynth 2.5\plugins\TNLMeans.dll"^) >> "%%~ni.avs"
echo Import^("C:\Program Files (x86)\AviSynth 2.5\plugins\SeeSaw.avs"^) >> "%%~ni.avs"
echo ImageReader^("%%~ni.ppm",start=1,end=1^) >> "%%~ni.avs"
echo Lanczos4Resize^(1440,960^) >> "%%~ni.avs"
echo function RGB32ToYV12^(clip input^) { >> "%%~ni.avs"
echo input.Crop(0, 0, -^(input.Width %% 2^), -^(input.Height %% 2^)^) >> "%%~ni.avs"
echo ConvertToYV24^(matrix="PC.601"^) >> "%%~ni.avs"
echo YToUV^(UToY8, VToY8, PointResize(last.Width * 2, last.Height * 2^)^) >> "%%~ni.avs"
echo } >> "%%~ni.avs"
echo RGB32ToYV12^(^) >> "%%~ni.avs"
echo TNLMeans^(h=2,ax=5,ay=5,bx=0,by=0,sx=2,sy=2,a=1.0^) >> "%%~ni.avs"
echo dull = last >> "%%~ni.avs"
echo dull.ConvertToYV12^(^)SeeSaw^(NRlimit=0, NRlimit2=5, Sstr=1.5, Szp=1, Slimit=50, Sdamplo=16, Spower=1, sootheT=95, SdampHi=39^) >> "%%~ni.avs"
echo function YV12ToRGB32^(clip input^) { >> "%%~ni.avs"
echo input >> "%%~ni.avs"
echo YToUV^(UToY8, VToY8, PointResize^(last.Width / 2, last.Height / 2^)^) >> "%%~ni.avs"
echo ConvertToRGB32^(matrix="PC.601"^) >> "%%~ni.avs"
echo } >> "%%~ni.avs"
echo YV12ToRGB32^(^) >> "%%~ni.avs"
echo ImageWriter^(file = "%%~ni_tonemap", start = 0, end = 0, type = "ppm"^) >> "%%~ni.avs"
echo C:\cmdtools\avs2avi.exe "%%~ni.avs" -o n -c xvid >> "%%~ni.cmd"
echo del %%~ni.ppm >> "%%~ni.cmd"
echo del %%~ni.avs >> "%%~ni.cmd"
echo ren %%~ni_tonemap000000.ppm "%%~ni_tonemap.ppm" >> "%%~ni.cmd"
echo C:\cmdtools\convert "%%~ni_tonemap.ppm" -color-matrix " 1.1 0.0 0.0 0.0, 0.0, -0.05 0.0 1.1 0.0 0.0, 0.0, -0.05 0.0 0.0 1.14 0.0, 0.0, -0.05 0.0 0.0 0.0 1.0, 0.0, 0.0 0.0 0.0 0.0 0.0, 1.0, 0.0 0.0 0.0 0.0 0.0, 0.0, 1.0" "%%~ni_tonemap.ppm" >> "%%~ni.cmd"
echo C:\cmdtools\exiftool.exe -tagsFromFile %%i %%~ni_tonemap.ppm >> "%%~ni.cmd"
echo C:\cmdtools\convert -rotate "-90" %%~ni_tonemap.ppm %%~ni_small_rotated.ppm >> "%%~ni.cmd"
echo C:\cmdtools\exiftool.exe -tagsFromFile %%i %%~ni_small_rotated.ppm >> "%%~ni.cmd"
echo C:\cmdtools\exiftool.exe -Orientation=1 -n %%~ni_small_rotated.ppm >> "%%~ni.cmd"
echo C:\cmdtools\convert %%~ni_small_rotated.ppm -quality 87 %%~ni_small_rotated.jpg >> "%%~ni.cmd"
call "%%~ni.cmd"
del "%%~ni.cmd"
del "%%~ni_tonemap.ppm"
del "%%~ni_small_rotated.ppm"
del "%%~ni_ori.tmp"
)
)
)
move *.CR2 raw
move *_small.jpg web
move *_small_rotated.jpg web
echo -------------------------------------------------------------
echo --------------------process finish---------------------------
echo -------------------------------------------------------------
Keine Ahnung ob wer was mit anfangen kann
