update tests again

This commit is contained in:
John Cupitt 2014-10-05 09:28:17 +01:00
parent 2e2cc9ea7a
commit 23c04fcfee
2 changed files with 18 additions and 12 deletions

10
python/im.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
convert $1 \
-background Red -density 300 \
-font /usr/share/fonts/truetype/msttcorefonts/Arial.ttf \
-pointsize 12 -gravity south -splice 0x150 \
-gravity southwest -annotate +50+50 "left corner" \
-gravity southeast -annotate +50+50 'right corner' \
+repage \
$2

View File

@ -2,24 +2,20 @@
import sys
#import logging
#logging.basicConfig(level = logging.DEBUG)
from gi.repository import Vips
from vips8 import vips
im = Vips.Image.new_from_file(sys.argv[1])
im = im | im
im = Vips.Image.new_from_file(sys.argv[1], access = Vips.Access.SEQUENTIAL)
black = Vips.Image.black(im.width, 150)
red = black + [255, 0, 0]
left = Vips.Image.text("Left corner").embed(50, 50, im.width, 150)
right_text = Vips.Image.text("Right corner")
red = (black + [255, 0, 0]).cast(Vips.BandFormat.UCHAR)
left_text = Vips.Image.text("left corner", dpi = 300)
right_text = Vips.Image.text("right corner", dpi = 300)
left = left_text.embed(50, 50, im.width, 150)
right = right_text.embed(im.width - right_text.width - 50, 50, im.width, 150)
footer = (left | right).ifthenelse(black, red, blend = True)
footer = (left | right).blend(black, red)
im = im.insert(footer, 0, im.height - footer.height)
im = im.insert(footer, 0, im.height, expand = True)
im.write_to_file(sys.argv[2])