Skip to content

Commit

Permalink
fix svgtopng
Browse files Browse the repository at this point in the history
  • Loading branch information
jgstew committed Aug 15, 2023
1 parent 6e31e7d commit b079c83
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion SharedProcessors/FileImageSvgToPng.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@
See docstring for FileImageSvgToPng class
"""

import os.path

# Requires cairosvg: python -m pip install --upgrade cairosvg
import cairosvg

# also needs:
# brew install cairo libffi

from autopkglib import ( # pylint: disable=import-error,unused-import
Processor,
ProcessorError,
Expand Down Expand Up @@ -47,7 +53,7 @@ def convert_svg_to_png(self, svg_path, png_path, max_pixel_dim):

def main(self):
"""execution starts here"""
max_pixel_dim = self.env.get("max_pixel_dim", 256)
max_pixel_dim = int(self.env.get("max_pixel_dim", 256))
if max_pixel_dim == 0:
max_pixel_dim = 256
file_pathname = self.env.get("file_pathname", self.env.get("pathname", None))
Expand Down
2 changes: 2 additions & 0 deletions Test-Recipes/FileImageSvgToPng.test.recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ Process:
COMPUTE_HASHES: False

- Processor: com.github.jgstew.SharedProcessors/FileImageSvgToPng
Arguments:
max_pixel_dim: 200

0 comments on commit b079c83

Please sign in to comment.