Remove cairosvg as it doesn't have pip-only lib. Use png instead.

This commit is contained in:
Cole Deck 2024-03-21 19:39:43 -05:00
parent 1bf10f7349
commit 9c9435570b
5 changed files with 13 additions and 8 deletions

2
.gitignore vendored
View File

@ -15,7 +15,7 @@ output.mp4
# log files
output.log
# images
*.png
map*.png
# Built app
build
# Generated label images

BIN
belden-logo-superhires.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 448 KiB

View File

@ -9,7 +9,7 @@ import numpy as np
from util import find_data_file
import segno
import io
import cairosvg
#import cairosvg
#import math
@ -260,12 +260,17 @@ def qr_image(data, width=600):
svg_path = find_data_file("belden-logo.svg")
with open(svg_path, 'rb') as svg_file:
png_image = cairosvg.svg2png(file_obj=svg_file,dpi=width*8, scale=7, background_color="white")
png_image_io = io.BytesIO(png_image)
#svg_path = find_data_file("belden-logo.svg")
#with open(svg_path, 'rb') as svg_file:
# png_image = cairosvg.svg2png(file_obj=svg_file,dpi=width*30, scale=30, background_color="white")
#with open("output.png", 'wb') as file:
# file.write(png_image)
png_image_io = "belden-logo-superhires.png"
png_image_pillow = Image.open(png_image_io)
png_width, png_height = png_image_pillow.size
png_image_pillow = png_image_pillow.resize((int(width*5.2), int(width*5.2/png_width*png_height)))
png_width, png_height = png_image_pillow.size
# paste belden logo first because it has a big border that would cover stuff up
img.paste(png_image_pillow, (int(width*5-png_width/2), int(width*4.25 - png_height/2)))

View File

@ -19,7 +19,7 @@ pandas
pyarrow
ghostscript
pyzbar
cairosvg
segno
# Development
matplotlib

View File

@ -10,7 +10,7 @@ import opcode
import os
import distutils
#distutils_path = os.path.join(os.path.dirname(opcode.__file__), 'distutils')
build_exe_options = {"include_msvcr": True, "packages": ["camelot", "setuptools"], "optimize": 0, "silent": True, "include_files": ["gs10030w64.exe", "GothamCond-Medium.otf", "belden-logo.svg"], "excludes": ["scipy", "torch"]}
build_exe_options = {"include_msvcr": True, "packages": ["camelot", "setuptools", "segno"], "optimize": 0, "silent": True, "include_files": ["gs10030w64.exe", "GothamCond-Medium.otf", "belden-logo-superhires.png", "VERSION"], "excludes": ["scipy", "torch"]}
# base="Win32GUI" should be used only for Windows GUI app
base = "console"