Slide 1

Slide 1 text

Hong Minhee Wand

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

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

Slide 10

Slide 10 text

Install $ pip install Wand $ easy_install Wand

Slide 11

Slide 11 text

ImageMagick $ apt-get install libmagickwand-dev $ yum install ImageMagick-devel http://dahlia.kr/wand/guide/install.html

Slide 12

Slide 12 text

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')

Slide 26

Slide 26 text

Seam carving

Slide 27

Slide 27 text

Seam carving

Slide 28

Slide 28 text

Further reading http://dahlia.kr/wand/

Slide 29

Slide 29 text

Fork/pull request https://github.com/dahlia/wand

Slide 30

Slide 30 text

Discussion [email protected] http://librelist.com/browser/wand/

Slide 31

Slide 31 text

Talk permalink http://j.mp/pykr2012-wand