diff --git a/TODO b/TODO index 5a373313..1f149acc 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,41 @@ +- try: + +#!/usr/bin/python + +import sys + +from gi.repository import Vips + +# we can stream the image, turn on sequential access +#im = Vips.Image.new_from_file(sys.argv[1], access = Vips.Access.SEQUENTIAL) +im = Vips.Image.new_from_file(sys.argv[1]) + +text = Vips.Image.text(sys.argv[3], width = 500, dpi = 300) +text = (text * 0.3).cast("uchar") +text = text.embed(100, 100, text.width + 200, text.width + 200) +text = text.replicate(1 + im.width / text.width, 1 + im.height / text.height) +text = text.crop(0, 0, im.width, im.height) + +im = text.ifthenelse([255, 0, 0], im, blend = True) + +im.write_to_file(sys.argv[2]) + + makes a mono output from a colour input! + + x = c.ifthenelse(a, b) + + c - mono image + a - vector constant + b - colour image + + + + + +- msb in colour should not touch alpha channel + + ... or should it? should converting RGBA from 8 to 16-bit touch alpha too? + probably - use vips_resize() in vipsthumbnail? diff --git a/test/test_colour.py b/test/test_colour.py index 24ebc302..9ecf1887 100755 --- a/test/test_colour.py +++ b/test/test_colour.py @@ -135,6 +135,7 @@ class TestColour(unittest.TestCase): before = test.getpoint(10, 10) after = im3.getpoint(10, 10) + self.assertAlmostEqualObjects(before, after, places = 1) # test Lab->XYZ on mid-grey