Python Imaging Library Overview
|March12,2002|FredrikLundh, ,anefficientinternalrepresentation, ' ,convertbetweenfileformats,printimages, , ,youcanuseJackJansen' ,there' ,includingpointoperations,filteringwitha setofbuilt-inconvolutionkernels, , ' , , ;eitherbyloadingimagesfromfiles,processi ngotherimages, ,usetheopenfunctionintheImagemodule.>>> import Image>>> im = (" ")Ifsuccessful, >>> print , , (512, 512) , (inpixels).Themodeattributedefinesthenum berandnamesofthebandsintheimage, "L"(luminance)forgreyscaleimages,"RGB"fo rtruecolourimages,and"CMYK" , , ,let'sdisplaytheimagewejustloaded: >>> ()(Thestandardversionofshowisnotveryeffi cient, 'thavexvinstalled,itwon' ,itisveryhandyfordebuggingandtests.) , ' , , , :ConvertfilestoJPEGimport os, sysimport Imagefor infile in [1:]: outfile = (infile)[0] + ".jpg" if infile != outfile: try: (infile).save(outfile) except IOError: print "cannot convert", ,youmustalwaysspecifytheformatthisway:Ex ample:CreateJPEGThumbnailsimport os, sysimport Imagefor infile in [1:]: outfile = (infile)[0] + ".
Tutorial Using the Image Class The most important class in the Python Imaging Library is the Image class, defined in the module with the same name. You can create instances of this class in several ways; either
Download Python Imaging Library Overview
Information
Domain:
Source:
Link to this page:
Please notify us if you found a problem with this document: