forked from Gro/member-map
increase png size and crop padding
This commit is contained in:
parent
e2b6c2b3b6
commit
b5883a8267
@ -4,7 +4,7 @@ ARG PLZ_DATA=Postleitzahlengebiete_-_OSM.geojson
|
|||||||
ARG PLZ_HIGHLIGHT=wtf_member_plz_prefixes.json
|
ARG PLZ_HIGHLIGHT=wtf_member_plz_prefixes.json
|
||||||
|
|
||||||
# Set up environment with dependencies
|
# Set up environment with dependencies
|
||||||
RUN apt-get update && apt-get install libblas-dev python3-pip libgeos-dev wget -y
|
RUN apt-get update && apt-get install libblas-dev python3-pip libgeos-dev wget optipng imagemagick -y
|
||||||
COPY requirements.txt ./
|
COPY requirements.txt ./
|
||||||
RUN pip install -r requirements.txt
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
@ -16,5 +16,8 @@ COPY $PLZ_HIGHLIGHT ./
|
|||||||
COPY main.py ./
|
COPY main.py ./
|
||||||
RUN python3 main.py --plz-data $PLZ_DATA --plz-highlight $PLZ_HIGHLIGHT --out /tmp/map.png
|
RUN python3 main.py --plz-data $PLZ_DATA --plz-highlight $PLZ_HIGHLIGHT --out /tmp/map.png
|
||||||
|
|
||||||
|
RUN convert -fuzz 5 -trim /tmp/map.png /tmp/map.png
|
||||||
|
RUN optipng -o7 /tmp/map.png
|
||||||
|
|
||||||
# Output map; use with "docker build -t wtf-map . && docker run wtf-map > map.png"
|
# Output map; use with "docker build -t wtf-map . && docker run wtf-map > map.png"
|
||||||
CMD ["cat", "/tmp/map.png"]
|
CMD ["cat", "/tmp/map.png"]
|
||||||
|
9
main.py
9
main.py
@ -48,9 +48,14 @@ def main(
|
|||||||
)
|
)
|
||||||
|
|
||||||
ax.set_facecolor(image_background_color)
|
ax.set_facecolor(image_background_color)
|
||||||
plt.tight_layout()
|
plt.axis("off")
|
||||||
|
plt.tight_layout(pad=0.0, h_pad=None, w_pad=None)
|
||||||
plt.savefig(
|
plt.savefig(
|
||||||
output_file_path, dpi=300, facecolor=image_background_color, edgecolor="none"
|
output_file_path,
|
||||||
|
dpi=600,
|
||||||
|
facecolor=image_background_color,
|
||||||
|
edgecolor="none",
|
||||||
|
bbox_inches='tight',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user