Add minimal support for SVG conversion and probing #181
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #113
Changes:
convert_svg2png
function to convert SVG to PNGconvert_image
API for three reasons. First it would make the code ofconvert_image
more complex since we would have to first probe for image format to know if it is SVG (this is for now handled internally in PIL library, but does not work for SVG). Second because the conversion is almost always requiring to pass output width/height and these are different parameters for CairoSVG than for PIL, so the "user" already need to know that he is converting a SVG. Third because current need (convert SVG icon of websites in warc2zim) is only focused on conversion to PNG whileconvert_image
is far more generic ; and CairoSVG does not have a generic conversion function, only conversion to a given format.Nota: #178 must be reviewed and merged first, these changes are based on this other PR