Listing 10. Makefile to Convert xcf Files to Composited JPEG
Images

tmp_img=/tmp/tmp_img.xcf
tmp2_img=/tmp/tmp_img.xcf
background_img=mybackground.png
simplelayered_extension=xcf
simplelayered_targets=\
  $(patsubst %.xcf,%.jpg,$(wildcard *.xcf))

all: $(simplelayered_targets)

$(simplelayered_targets): %.jpg: %.xcf
        if_xcf=$<; \
        if=`basename $< .xcf`.png \
        of=$@; \
        of_thumbnail=`basename $@ .jpg`-thumb.jpg \
        gimp-monkeyiq-append-layer-from-image-file \
           -inputimage `pwd`/$$if_xcf \
           -outputimage $(tmp_img) \
           -layerimage `pwd`/$(background_img) \
           -layername  "background-layer"; \
        gimp-monkeyiq-save-as-jpg \
           -inputimage  $(tmp_img)
           -outputimage $$of; \
        gimp-monkeyiq-scale \
           -inputimage  `pwd`/$$if_xcf \
           -outputimage $(tmp_img); \
           -ratio 0.15; \
        gimp-monkeyiq-append-layer-from-image-file \
           -inputimage  $(tmp_img) \
           -outputimage $(tmp2_img) \
           -layerimage `pwd`/$(background_img) \
           -layername  "background-layer"; \
        gimp-monkeyiq-layers-showall \
           -inputimage  $(tmp2_img) \
           -outputimage $(tmp_img); \
        gimp-monkeyiq-layers-hidebyre \
           -inputimage  $(tmp_img) \
           -outputimage $(tmp2_img) \
           -layersre "background-layer"; \
        gimp-monkeyiq-move-visible-layers \
           -inputimage  $(tmp2_img) \
           -outputimage $(tmp_img) \
           -xoffset 200 -yoffset 100; \
        gimp-monkeyiq-save-as-jpg \
           -inputimage $(tmp_img)
           -outputimage $$of;

