Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
Create thumbnail images using python image library
SUBMITTED BY:
Bun
DATE:
Feb. 16, 2016, 11:15 a.m.
FORMAT:
Python 3
SIZE:
417 Bytes
Raw
Download
Tweet
HITS:
787
Go to comments
Report
import
os
,
sys
import
Image
size
=
128
,
128
for
imgfiles
in
sys
.
argv
[
1
:]:
outimg
=
os
.
path
.
splitext
(
imgfiles
)[
0
]
+
".thumbnail"
if
imgfiles
!=
outimg
:
try
:
imthumb
=
Image
.
open
(
imgfiles
)
imthumb
.
thumbnail
(
size
,
Image
.
ANTIALIAS
)
imthumb
.
save
(
outimg
,
"JPEG"
)
except
IOError
:
print
(
"thumbnail cannot be created for '
%s
'"
)
%
imgfiles
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus