MSYS2-packages/msys2-unlocker/splash/convert-all-xcf-to-jpg
Christoph Reiter 11a162b0e5 repo: make file executable permissions match the cygwin derived status
In case we have a git clone from Linux that is accessed via cygwin git
the files executable status will be derived from the file content (shebang)
and won't match the git repo, leading to a initially dirty tree.

This can be worked around by setting "core.filemode=false", but let's try
to match the cygwin permissions with the in-repo permissions so this isn't
needed.
2024-04-14 15:17:42 +02:00

56 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# Most credit to:
# http://billauer.co.il/blog/2009/07/gimp-xcf-jpg-jpeg-convert-bash-script/
if ! which gimp > /dev/null 2>&1; then
[ -f /mingw64/bin/gimp.exe ] && PATH=/mingw64/bin:$PATH
fi
if ! which gimp > /dev/null 2>&1; then
[ -f /mingw32/bin/gimp.exe ] && PATH=/mingw32/bin:$PATH
fi
if ! which gimp > /dev/null 2>&1; then
echo "gimp not found, do you need to install it?"
exit 1
fi
#if [ "1" = "0" ]; then
{
cat <<EOF
(define (convert-xcf-to-jpeg filename outfile)
(let* (
(image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(drawable (car (gimp-image-merge-visible-layers image CLIP-TO-IMAGE)))
)
(file-jpeg-save RUN-NONINTERACTIVE image drawable outfile outfile .9 0 0 0 " " 0 1 0 1)
(gimp-image-delete image) ; ... or the memory will explode
)
)
(gimp-message-set-handler 1) ; Messages to standard output
EOF
for i in *.xcf; do
echo "(gimp-message \"$i\")"
echo "(convert-xcf-to-jpeg \"$i\" \"${i%%.xcf}.jpg\")"
done
echo "(gimp-quit 0)"
} | gimp -i -b -
#fi
FRAMES=0
JPG_FILES=$(find . -name "*.jpg" -printf "%f\n" | sort)
echo "" > ../splash_frames.rc.h
echo "" > ../splash_frames.h
for i in $JPG_FILES; do
FRAME_NUM=$(echo $i | sed 's|[^0-9]||g')
mv "${i}" ../
echo "#define IDC_SPLASH_JPG_${FRAME_NUM} IDC_SPLASH_START + ${FRAMES}" >> ../splash_frames.h
echo IDC_SPLASH_JPG_${FRAME_NUM} RCDATA MOVEABLE PURE \"${i}\" >> ../splash_frames.rc2
FRAMES=`expr $FRAMES + 1`
done
echo "#define IDC_SPLASH_COUNT ${FRAMES}" >> ../splash_frames.h