Merge pull request 'bugfix/map-has-no-border' (#8) from bugfix/map-has-no-border into master

Reviewed-on: #8
This commit is contained in:
Sarah 2022-09-09 21:44:24 +00:00
commit 11ba1e6212
1 changed files with 5 additions and 3 deletions

View File

@ -2,7 +2,7 @@ import base64
from collections import Counter, OrderedDict
import csv
import os
from wand.image import Image
import pyvips
import worldmap
import warnings
@ -94,8 +94,10 @@ def draw_map(films_by_country, file_name="vcinema_map.svg"):
worldmap.plot(countries, cmap=["#FF4000"], opacity=opacity, filename=file_name, verbose=False)
with Image(filename=file_name, width=1000, height=655) as i:
png_data = i.make_blob("png")
image = pyvips.Image.new_from_file(file_name)
image = image.thumbnail_image(1000, crop=pyvips.Interesting.ALL)
png_data = image.write_to_buffer(".png")
os.remove(file_name)