Example #1
0
 def test_coalesce(self):  # TODO: input optimized .gif file.
     f = wpi.coalesce
     with Image() as t:
         with self.rose.clone() as p:
             for i in range(5):
                 wpi.blur(p, 0, 1)
                 wpi.add(t, p)
         with f(t) as p:
             save(p, f)
Example #2
0
 def test_fft(self):
     f = wpi.forwardfouriertransform  # require IM build option '--with-fftw'
     with self.logo.clone() as t:  # I couldn't build on Windows...
         f(t, True)
         save(t, f)  # includes two images(magnitude&phase)
         f = wpi.inversefouriertransform
         with t.sequence[0].clone() as mag:
             with t.sequence[1].clone() as phase:
                 wpi.blur(mag, 0, 0.5)  # as degradation
                 t2 = mag
                 f(t2, phase, True)
                 save(t2, f)
Example #3
0
#         font_denser_soft_outline.jpg

w = 320
h = 100
with Image(width=w, height=h, background=Color('lightblue')) as img:
    with Drawing() as draw0:
        text = 'Anthony'
        draw0.font = 'Candice'
        draw0.font_size = 72
        draw0.gravity = 'forget'

        x = 25
        y = 65

        # drawing shadow
        with draw0.clone() as draw:
            draw.fill_color = Color('black')
            draw.stroke_color = Color('black')
            draw.stroke_width = 8
            draw.text(x, y, text)
            draw(img)
        blur(img, 0, 8)

        # drawing foreground text
        with draw0.clone() as draw:
            draw.fill_color = Color('white')
            draw.text(x, y, text)
            draw(img)

        img.save(filename='sample25.png')
Example #4
0
    clutimg.composite_channel(def_ch, tmp, 'overlay')
clutimg.rotate(90)


# make text image
inputimg = None
with Drawing() as draw:
    draw.font = font
    draw.font_size = font_size
    (w, h) = calcSuitableImagesize(draw, text)
    inputimg = Image(width=w, height=h, background=Color('white'))
    draw.fill_color = Color('black')
    draw.gravity = 'center'
    draw.text(0, 0, text)
    draw(inputimg)
blur(inputimg, 0, 5)
inputimg.level(black=0.4, white=0.6)
blur(inputimg, 0, 3)
inputimg.alpha_channel = False


# start: making of matalic image
baseimg = Image(filename='gradient:rgb(100%,100%,100%)-black',
                width=inputimg.width, height=inputimg.height)

# 1.make masked text
with inputimg.clone() as tmp:
    tmp.negate()
    baseimg.composite_channel(def_ch, tmp, 'copy_opacity')
# baseimg.save(filename='sample41-1.png')
Example #5
0
#!/usr/bin/env python

from wand.image import Image
from wand.drawing import Drawing
from wand.color import Color
from wandplus.image import blur, spread

# http://www.imagemagick.org/Usage/fonts/
# original imagemagick command:
#  convert -size 320x100 xc: \
#          -font Candice -pointsize 72 -annotate +25+65 'Anthony' \
#          -spread 1 -blur 0x1 -threshold 50% -blur 0x1 font_dirty_print.jpg

w = 320
h = 100
with Image(width=w, height=h, background=Color('white')) as img:
    with Drawing() as draw:
        text = 'Anthony'
        draw.font = 'Candice'
        draw.font_size = 72
        draw.gravity = 'forget'
        draw.fill_color = Color('black')
        draw.text(25, 65, text)
        draw(img)
        spread(img, 'bilinear', 1)
        blur(img, 0, 1)
        img.threshold(0.5)
        blur(img, 0, 1)
        img.save(filename='sample27.png')
Example #6
0

with Drawing() as draw:
    text = ' I M  Examples '
    draw.font = 'Anaconda-Regular'
    draw.font_size = 72
    (w, h) = calcSuitableImagesize(draw, text)

    # make text image
    textimg = Image(width=w, height=h, background=Color('black'))
    draw.gravity = 'center'
    draw.fill_color = Color('dodgerblue')
    draw.text(0, 0, text)
    draw(textimg)
    textimg.border(Color('black'), 30, 30)

    # make shadow image
    shadowimg = textimg.clone()
    blur(shadowimg, 0, 25)
    shadowimg.level(black=0.0, gamma=1.0, white=0.5)

    # composite all
    canvas = Image(width=shadowimg.width, height=shadowimg.height)
    canvas.composite(shadowimg, 0, 0)
    canvas.composite_channel('default_channels', textimg, 'screen')
    canvas.save(filename='sample40.png')

    shadowimg.destroy()
    textimg.destroy()
    canvas.destroy()
Example #7
0
#!/usr/bin/env python

from wand.image import Image
from wand.drawing import Drawing
from wand.color import Color
from wandplus.image import blur

# http://www.imagemagick.org/Usage/fonts/
# original imagemagick command:
# convert -size 320x100 xc:lightblue -font Candice -pointsize 72 \
#         -fill navy  -annotate +25+65 'Anthony' \
#         -blur 0x3   font_fuzzy.jpg

w = 320
h = 100
with Image(width=w, height=h, background=Color('lightblue')) as img:
    with Drawing() as draw:
        text = 'Anthony'
        draw.font = 'Candice'
        draw.font_size = 72
        draw.gravity = 'center'
        draw.fill_color = Color('navy')
        draw.text(0, 0, text)
        draw(img)
        blur(img, 0, 3)
        img.save(filename='sample22.png')
Example #8
0
# http://www.imagemagick.org/Usage/fonts/
# original imagemagick command:
# convert -size 320x100 xc:lightblue -font Candice -pointsize 72 \
#         -annotate +30+70 'Anthony'   -blur 0x4 \
#         -fill white  -stroke black  -annotate +25+65 'Anthony' \
#         font_shadow_fuzzy.jpg

w = 320
h = 100
with Image(width=w, height=h, background=Color('lightblue')) as img:
    with Drawing() as draw0:
        text = 'Anthony'
        draw0.font = 'Candice'
        draw0.font_size = 72
        draw0.gravity = 'forget'

        with draw0.clone() as draw:
            draw.fill_color = Color('black')
            draw.text(30, 70, text)
            draw(img)
        blur(img, 0, 4)

        with draw0.clone() as draw:
            draw.fill_color = Color('white')
            draw.stroke_color = Color('black')
            draw.text(25, 65, text)
            draw(img)

        img.save(filename='sample23.png')