Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
3pia
VISPA
VISPA web
Commits
5fbbd419
Commit
5fbbd419
authored
Apr 07, 2014
by
Gero Müller
Browse files
fix pil thumbnails
parent
250cee56
Changes
1
Show whitespace changes
Inline
Side-by-side
vispa/remote/filesystem.py
View file @
5fbbd419
...
...
@@ -13,9 +13,9 @@ import shutil
import
stat
import
subprocess
try
:
import
Image
import
ImageFilter
HAVE_PIL
=
True
except
:
HAVE_PIL
=
False
...
...
@@ -389,11 +389,15 @@ class FileSystem(object):
def
expand
(
self
,
path
):
return
os
.
path
.
expanduser
(
os
.
path
.
expandvars
(
path
))
def
thumbnail
(
self
,
path
,
width
=
100
,
height
=
100
):
def
thumbnail
(
self
,
path
,
width
=
100
,
height
=
100
,
sharpen
=
True
):
path
=
self
.
expand
(
path
)
if
HAVE_PIL
:
output
=
StringIO
()
Image
.
open
(
path
).
thumbnail
((
width
,
height
)).
save
(
output
,
"png"
)
img
=
Image
.
open
(
path
)
img
.
thumbnail
((
width
,
height
))
if
sharpen
:
im
.
filter
(
ImageFilter
.
SHARPEN
)
img
.
save
(
output
,
"JPEG"
)
contents
=
output
.
getvalue
()
output
.
close
()
return
contents
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment