This commit is contained in:
John Cupitt 2015-02-10 10:17:01 +00:00
parent ffbb259c86
commit 62177ad24e
2 changed files with 39 additions and 0 deletions

38
TODO
View File

@ -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?

View File

@ -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