Speaker: Hong Minhee
http://dahlia.kr/
https://github.com/dahlia
https://bitbucket.org/dahlia
@hongminhee
Slide 4
Slide 4 text
Speaker: Hong Minhee
Hobbyist programmer since 1999
Python programmer since 2005
PyPy enthusiast
Anti-fan of Django
StyleShare (2011–2012)
Slide 5
Slide 5 text
https://stylesha.re/
Slide 6
Slide 6 text
Speaker: Hong Minhee
Hobbyist programmer since 1999
Python programmer since 2005
PyPy enthusiast
Anti-fan of Django
StyleShare (2011–2012)
Crosspop (2012–)
Slide 7
Slide 7 text
http://crosspop.in/
Slide 8
Slide 8 text
Wand: Short introduction
Image Processing Library
Built on top of ImageMagick
Modern PythonicTM API
Supports CPython 2.6+, PyPy☆, Jython (soon)
Well Documented
Properly Packaged
MIT Licensed
Competitior of Python Imaging Library (PIL)
Slide 9
Slide 9 text
Too many ImageMagick bindings
PyPI Docs PyPy Update
PythonMagick ☹ ☹ ☹ 2012-10
PythonMagickWand
Achim Domma
☺ ☹ ☹ 2008-07
PythonMagickWand
Ian Stevens
☹ ☹ ☹ 2009-01
python-magickwand
Benjamin Schweizer
☺ ☹ ☹ 2012-01
magickwand
Oliver Berger
☺ ☹ ☹ 2010-06
Wand ☺ ☺ ☺ 2012-11
try+finally < with
from wand.image import Image
try:
image = Image(width=480, height=320)
assert image.size == (480, 320)
image.save(filename='transparent-480x320.jpg')
finally:
image.close()
Slide 13
Slide 13 text
try+finally < with
from wand.image import Image
with Image(width=480, height=320) as image:
assert image.size == (480, 320)
image.save(filename='transparent-480x320.jpg')
Slide 14
Slide 14 text
try+finally < with
from wand.color import Color
from wand.image import Image
with Color('white') as bg:
with Image(width=480, height=320, background=bg) as i:
assert i.size == (480, 320)
i.save(filename='white-480x320.jpg')
Slide 15
Slide 15 text
Converting
from urllib2 import urlopen
from wand.image import Image
with Image(file=urlopen('http://j.mp/wand-iu-1')) as i:
assert i.format == 'jpeg'
with i.convert('png') as png:
png.save(filename='wand-iu-1.png')
Slide 16
Slide 16 text
Resizing
Slide 17
Slide 17 text
Resizing
from urllib2 import urlopen
from wand.image import Image
with Image(file=urlopen('http://j.mp/wand-iu-1')) as i:
i.save(filename='wand-iu-1.jpg')
assert i.size == (1200, 800)
i.resize(480, 320)
i.save(filename='resized.jpg')
Slide 18
Slide 18 text
Resizing
Slide 19
Slide 19 text
Cropping
Slide 20
Slide 20 text
Cropping
from urllib2 import urlopen
from wand.image import Image
with Image(file=urlopen('http://j.mp/wand-iu-2')) as image:
image.save(filename='wand-iu-2.jpg')
assert image.size == (720, 887)
with image[:230, :] as cropped:
cropped.save(filename='cropped.jpg')
Slide 21
Slide 21 text
Cropping
Slide 22
Slide 22 text
Cropping
Slide 23
Slide 23 text
0.3 will be soon
It will include:
● Python 3 compatibility
● Drawing
● Sequences
● EXIF
● Seam carving
● Channels
● and so on
http://dahlia.kr/wand/roadmap.html
Slide 24
Slide 24 text
Seam carving
Slide 25
Slide 25 text
Seam carving
from urllib2 import urlopen
from wand.image import Image
with Image(file=urlopen('http://j.mp/wand-iu-3')) as i:
i.save(filename='wand-iu-3.jpg')
assert i.size == (1280, 1710)
i.liquid_rescale(1280, 1500)
i.save(filename='seam-carving.jpg')