use direct io for mastodon images

workspace
Brendan Howell 6 years ago
parent 5ab819f2cb
commit 89bee5e6b2

@ -299,11 +299,11 @@ class PublicRelations(Bureau):
if media.type == "image":
img = media
if img:
filename = img.url.rsplit('/',1)[1]
filename = "/tmp/" + filename
print("fetching", img.remote_url, filename)
#filename = img.url.rsplit('/',1)[1]
#filename = "/tmp/" + filename
#print("fetching", img.remote_url, filename)
req_data = requests.get(img.url)
im = PIL.Image.open(io.StringIO(filename))
im = PIL.Image.open(io.StringIO(req_data.content))
if im.mode in ("L", "RGB", "P"):
im = PIL.ImageOps.equalize(im)
im.thumbnail((576, 576), PIL.Image.ANTIALIAS)

Loading…
Cancel
Save