I'm almost ashamed to ask this, because it should be such a simple fix. But here goes.
This is a BASH question really so I feel pretty stupid for forgetting how to do it.
I am using a simple script to apply HALD-CLUT to multiple images. But the output is ending up with duplicated extensions. I'm obviously working with digital photos,and they are jpegs. I want my output for various reasons, to be png files.
Ok. Assuming my input file is nara.jpg, I get something like this as output: HALD-SAT25+noicc+nara.jpg.png
I would prefer this: HALD-SAT25-nara.png
Please excuse the messy commenting in the script. It is an old habit from the days many years ago when I actually wrote programs
These days I just can't remember simple stuff. Pretty obvious how it works.
The script I am using is this. It is not elegant, but since my brain injury I really do need the simplest approach these days with as few fancy bits to remember as possible:
Anyway, I've searched everything I can find on getting rid of that "+noicc+ (and) .jpg" string simply and just can't find it and cannot remember.
Thinking more about it, I should be able to use
basename $i (instead of +$file) but I just can;t think what parameters to use..
UPDATE - Ok, no variation of basename $i seems to work.
UPDATE 2 - I changed my script and stripped the '+' out everywhere that '+$' appeared. now I can get an output like:
But I am still getting the 'xxxx.jpg.png'.
There must be a way to strip the .jpg and end up with only my .png. It isn't critical - just annoying.
# Strip any embedded ICC profiles
for file in `ls *.jpg`; do
# convert $file +profile "*" 'noicc'+$file
convert $file +profile "*" 'noicc'$file
# Create an output folder
# Apply HALD-CLUT to image
## This works now - at last ##
for file in `ls noicc*`; do
# convert $file Hald_8-Sat30_S-Curve_Lev-IN15-Gam1.5.png -hald-clut 'HALD-SAT30'+$file.png
convert $file Hald_8-Sat30_S-Curve_Lev-IN15-Gam1.5.png -hald-clut 'HALD-SAT30'$file.png
# note - removed ALL + signs from file name args
# move the enhanced file to the output folder
# mv 'HALD-SAT30'+$file.png output
mv 'HALD-SAT30'$file.png output
# get rid of noicc file before starting over