Python Essential ??? - PowerPoint PPT Presentation

About This Presentation
Title:

Python Essential ???

Description:

Tkinter import ImageTk import Image win = ImageTk.Tkinter.Tk() im = Image.open( – PowerPoint PPT presentation

Number of Views:78
Avg rating:3.0/5.0
Slides: 12
Provided by: 4518
Category:

less

Transcript and Presenter's Notes

Title: Python Essential ???


1
Python Essential ???
2001. 5. 9(?)
  • The Python Imaging Library

??? ???
2
? Python Imaging Library(PIL)??? (1)
  • PIL???
  • ??????
  • ???????
  • ???
  • PIL????
  • Open, Rotate,
  • Save, Display
  • -??????
  • -Crop, paste
  • -Filtering
  • -Tkinter ??
  • ?????
  • Python Imaging Library? ????? ????
  • ??? ? ?? ??.
  • ? ?????? ??? ?? ??? ????,
  • ???? ?? ???? ??? ??? ?? ??
  • ? ???.
  • ???? Windows ? Linux/Unix? ????.
  • ??(core) ??? ?????? ? ???
  • ???? ?? ???? ???? ?? ????
  • ??? ????.
  • ? ?????? ???? ??? ?? ???
  • ???? ?? ????.

3
? Python Imaging Library(PIL)??? (2)
  • PIL???
  • ??????
  • ???????
  • ???
  • PIL????
  • Open, Rotate,
  • Save, Display
  • -??????
  • -Crop, paste
  • -Filtering
  • -Tkinter ??
  • ?????

? ?????? ??? ?? ??? ????. Image Archives -
PIL? ??? ?? ??? ?? ?? ?? thumbnail, ?? ???
??, ???? ?? ? - ?? ????? ?? ?? ??? ???? ???.
- ?? ??? ????? ??? ?? ???? ?? ?? ????
?? Image Display - ?? ???? PythonWin?? ??? ?
?? Windows DIB ?? ? ??? Tk PhotoImage?
BitmapImage ?????? ?? X? Mac??? Jack Jansen?
img library? ?? Image Processing - ???? ??? ??
?? ?? ? ??, ?? ???? ???? ??? ???, ??? ???
- ??? ?? ??, ?? ? ??? ??? ??? ?? ?? ?? - ?????
???? ??? ???? ???? ?? ??
4
? PIL? ???? ??
BMP CUR (read only) DCX (read only) EPS
(write-only) FLI, FLC (read only) FPX (read
only) GBR (read only) GD (read only) GIF ICO
(read only) IM IMT (read only) JPEG MIC (read
only) MCIDAS (read only)
MPEG (identify only) MSP PCD (read only) PCX PDF
(write only) PNG PPM PSD (read only) SGI (read
only) SUN (read only) TGA (read
only) TIFF XBM XPM (read only)
  • PIL???
  • ??????
  • ???????
  • ???
  • PIL????
  • Open, Rotate,
  • Save, Display
  • -??????
  • -Crop, paste
  • -Filtering
  • -Tkinter ??
  • ?????

5
? PIL? ???? ??? ???
BMP. ".bmp", ".dib" CUR. ".cur" DCX. ".dcx"
EPS. ".eps", ".ps" FLI. ".fli", ".flc" FPX.
".fpx" GBR. ".gbr" GD. ".gd" GIF. ".gif" ICO.
".ico" IM. ".im" JPEG. ".jpg", ".jpe", ".jpeg"
MIC. ".mic"
MSP. ".msp" PCD. ".pcd" PCX. ".pcx" PDF.
".pdf" PNG. ".png" PPM. ".pbm", ".pgm", ".ppm"
PSD. ".psd" SGI. ".bw", ".rgb", ".cmyk" SUN.
".ras" TGA. ".tga" TIFF. ".tif", ".tiff" XBM.
".xbm" XPM. ".xpm"
  • PIL???
  • ??????
  • ???????
  • ???
  • PIL????
  • Open, Rotate,
  • Save, Display
  • -??????
  • -Crop, paste
  • -Filtering
  • -Tkinter ??
  • ?????

6
? PIL ????(1)
  • PIL???
  • ??????
  • ???????
  • ???
  • PIL????
  • Open, Rotate,
  • Save, Display
  • -??????
  • -Crop, paste
  • -Filtering
  • -Tkinter ??
  • ?????

1. Open, rotate, save, display
import Image Open Image im Image.open("sample.
jpg") Rotate 45 r_im im.rotate(45) Save
Image r_im.save("rotated_sample.jpg",'JPEG') Dis
play Image r_im.show()
Show()? ?? ?????? BMP???? ??? ? ??? ????(???,
ACDSEE?)? ?? ????.
7
? PIL ????(2)
  • PIL???
  • ??????
  • ???????
  • ???
  • PIL????
  • Open, Rotate,
  • Save, Display
  • -??????
  • -Crop, paste
  • -Filtering
  • -Tkinter ??
  • ?????

2. ????(thumbnails) ??
? resize? ??? ??
import os, Image infile "sample.jpg " outfile
os.path.splitext(infile)0 "_s" ".jpg
" Image.open(infile).resize((128,128)).save(outfil
e,"JPEG")
? thumbnail? ??? ??
import os, Image infile "sample.jpg " outfile
os.path.splitext(infile)0 "_s" ".jpg " im
Image.open(infile) im.thumbnail((128,128)) im.save
(outfile,"JPEG")
? Thumbnail? ?? ????? ??? ?? ??
8
? PIL ????(3)
  • PIL???
  • ??????
  • ???????
  • ???
  • PIL????
  • Open, Rotate,
  • Save, Display
  • -??????
  • -Crop, paste
  • -Filtering
  • -Tkinter ??
  • ?????

3. Crop, Paste
? Crop
box (100,100,400,400) cutting
im.crop(box) cutting.save("cutting_sample.jpg","JP
EG")
? Paste
cutting cutting.rotate(180) im.paste(cutting,box
) im.save("paste.jpg")
9
? PIL ????(4)
  • PIL???
  • ??????
  • ???????
  • ???
  • PIL????
  • Open, Rotate,
  • Save, Display
  • -??????
  • -Crop, paste
  • -Filtering
  • -Tkinter ??
  • ?????

4. Filtering
ImageFilter Module? ???? ??, ?? ????
Filter? ??? ??.
BLUR , CONTOUR , DETAIL, EDGE_ENHANCE, EDGE_ENH
ANCE_MORE, EMBOSS , FIND_EDGES , SMOOTH,
SMOOTH_MORE, SHARPEN
????
import ImageFilter imout img.filter(ImageFilter.
BLUR)
10
? PIL ????(5)
  • PIL???
  • ??????
  • ???????
  • ???
  • PIL????
  • Open, Rotate,
  • Save, Display
  • -??????
  • -Crop, paste
  • -Filtering
  • -Tkinter ??
  • ?????

5. Tkinter?? ??
ImageTk Module? ???? ??
import ImageTk import Image win
ImageTk.Tkinter.Tk() im Image.open("sample.jpg")
img ImageTk.PhotoImage(im) can
ImageTk.Tkinter.Canvas(win) can.pack() can.create_
image(2,2,imageimg) win.mainloop()
Tkinter??? PhotoImage? GIF, PPM ?????? ????. ???
ImageTk??? ???? PIL? ???? ?? ?? ??? ??? ? ??.
11
? ?????
  • PIL???
  • ??????
  • ???????
  • ???
  • PIL????
  • Open, Rotate,
  • Save, Display
  • -??????
  • -Crop, paste
  • -Filtering
  • -Tkinter ??
  • ?????

Python Imaging Library (PIL) - ???
http//www.python.or.kr8080/python/GUI/pil/ PI
L handbook http//www.pythonware.com/library/pil
/handbook/ License http//www.pythonware.com/li
brary/pil/handbook

/software-license.htm
Write a Comment
User Comments (0)
About PowerShow.com