MCPcopy Create free account
hub / github.com/ActiveState/code / createThumbnails

Method createThumbnails

recipes/Python/271246_pyAlbumpy/recipe-271246.py:105–118  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

103 self.files.append(x)
104
105 def createThumbnails(self):
106 # Create thumbnails
107 self.tnDir = "thumbnails"
108 os.mkdir(self.tnDir)
109 for x in os.listdir(self.dirName):
110 os.chdir(self.dirName)
111 if(os.path.isfile(x)):
112 image_size = Image.open(x).size
113 width = int(image_size[0] * self.scale1)
114 height = int(image_size[1] * self.scale1)
115 img = Image.open(x)
116 img2 = img.resize([width,height],2)
117 os.chdir(self.tnDir)
118 img2.save(x)
119
120 def createImages(self):
121 # Create images for display in the files

Callers 1

recipe-271246.pyFile · 0.80

Calls 7

mkdirMethod · 0.80
chdirMethod · 0.80
isfileMethod · 0.80
listdirMethod · 0.45
openMethod · 0.45
resizeMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected