Create kra-output.sh
This commit is contained in:
parent
4012086d9b
commit
8ed68327ac
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
# kra processing
|
||||
# Wrote this script by taking some inspiration from bloodywing and David revoy's script
|
||||
|
||||
#: Author : Raghavendra kamath < raghu@raghukamath.com >
|
||||
#: License : GPL
|
||||
|
||||
|
||||
# get current working directory
|
||||
export cwd="$PWD"
|
||||
|
||||
#create appropriate folders for output
|
||||
mkdir output-lowres
|
||||
|
||||
#create a folder in tmp for unzipping contents of kra file
|
||||
mkdir -p /tmp/kra-output
|
||||
|
||||
#start the loop for each file in cwd
|
||||
for f in *.kra
|
||||
do
|
||||
echo "processing file - $f"
|
||||
|
||||
#unzip the merged png image inside kra file
|
||||
unzip -j "$f" "mergedimage.png" -d "/tmp/kra-output/" > /dev/null 2>&1
|
||||
|
||||
#convert the extracted png into normal srgb file and copy it back to output folder
|
||||
convert /tmp/kra-output/mergedimage.png -colorspace sRGB -background white -alpha remove -resize 40% -quality 95 "$cwd"/output-lowres/${f%.*}-lowres.jpg
|
||||
#remove the output image (need to find better way to do this)
|
||||
rm /tmp/kra-output/mergedimage.png
|
||||
done
|
||||
#delete the tmp folder
|
||||
rm -rf /tmp/kra-output
|
||||
echo "finished exporting"
|
Loading…
Reference in New Issue