วันศุกร์ที่ 9 มกราคม พ.ศ. 2558

สนุกกับ Image Processing ด้วย Python Image Library บน OpenSUSE 13.2

submarine@Sotharavej:~> su
Password:
Sotharavej:/home/submarine # zypper in python-imaging
Loading repository data...
Reading installed packages...
'python-imaging' not found in package names. Trying capabilities.
Resolving package dependencies...

The following 3 NEW packages are going to be installed:
  libopenjp2-7 libwebpmux1 python-Pillow

3 new packages to install.
Overall download size: 586.9 KiB. Already cached: 0 B  After the operation,
additional 2.1 MiB will be used.
Continue? [y/n/? shows all options] (y): y
Retrieving package libopenjp2-7-2.1.0-2.1.8.x86_64                         (1/3), 101.7 KiB (233.7 KiB unpacked)
Retrieving: libopenjp2-7-2.1.0-2.1.8.x86_64.rpm ..........................................................[done]
Retrieving package libwebpmux1-0.4.1-1.2.x86_64                            (2/3),  19.3 KiB ( 30.3 KiB unpacked)
Retrieving: libwebpmux1-0.4.1-1.2.x86_64.rpm ................................................[done (48.5 KiB/s)]
Retrieving package python-Pillow-2.5.1-3.1.4.x86_64                        (3/3), 465.9 KiB (  1.8 MiB unpacked)
Retrieving: python-Pillow-2.5.1-3.1.4.x86_64.rpm ...........................................[done (203.6 KiB/s)]
Checking for file conflicts: .............................................................................[done]
(1/3) Installing: libopenjp2-7-2.1.0-2.1.8 ...............................................................[done]
(2/3) Installing: libwebpmux1-0.4.1-1.2 ..................................................................[done]
(3/3) Installing: python-Pillow-2.5.1-3.1.4 ..............................................................[done]
Additional rpm output:
update-alternatives: using /usr/bin/pilconvert-2.7 to provide /usr/bin/pilconvert (pilconvert) in auto mode


Sotharavej:/home/submarine #

submarine@Sotharavej:~>
submarine@Sotharavej:~> cd images/
submarine@Sotharavej:~/images>
submarine@Sotharavej:~/images> ls
submarine.jpg
submarine@Sotharavej:~/images>
submarine@Sotharavej:~/images> python
Python 2.7.8 (default, Sep 30 2014, 15:34:38) [GCC] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> from PIL import Image
>>> im = Image.open("submarine.jpg")
>>> im.show()
>>>


       ลองหมุนภาพ 45 องศา ด้วยคำสั่ง

>>> im.rotate(45).show()
>>> 







ไม่มีความคิดเห็น:

แสดงความคิดเห็น