Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Svg conversion png #648

Merged
merged 11 commits into from Feb 18, 2016
Merged

Svg conversion png #648

merged 11 commits into from Feb 18, 2016

Conversation

rodrigolourenco
Copy link
Contributor

Added support on Thumbor for svg conversion on png.

Using the Cairo (http://cairographics.org/) library with the python library CairoSVG (http://cairosvg.org/) for conversion. Now, Thumbor was capable for doing this transparent verifying the mime type of the image and applying a conversion.

Sample:
http://localhost:8888/unsafe/https://upload.wikimedia.org/wikipedia/commons/2/2f/Google_2015_logo.svg

@guilhermef
Copy link
Member

@rodrigolourenco It's better to keep cairoSVG outside the setup.py and only add svg support if carioSVG is available.

@rodrigolourenco
Copy link
Contributor Author

@guilhermef Removed cairosvg from setup.py and checked if svg conversion to png is available.

@guilhermef
Copy link
Member

@rodrigolourenco I need you to rebase this PR.

@rodrigolourenco
Copy link
Contributor Author

@guilhermef done, PR updated.

guilhermef added a commit that referenced this pull request Feb 18, 2016
@guilhermef guilhermef merged commit 14070c0 into thumbor:master Feb 18, 2016
@guilhermef
Copy link
Member

thanks @rodrigolourenco

@znerol
Copy link
Contributor

znerol commented Feb 24, 2016

It seems to me that many SVGs start with an XML preabmble (i.e. <?xml version="1.0" encoding="UTF-8"?>) some also have a DOCTYPE declaration before the the SVG tag. Hence the magic sniffing code used here might fail to detect quite some files.

Example: https://upload.wikimedia.org/wikipedia/commons/b/b0/NewTux.svg

@znerol
Copy link
Contributor

znerol commented Feb 24, 2016

@znerol
Copy link
Contributor

znerol commented Feb 24, 2016

@znerol
Copy link
Contributor

znerol commented Feb 25, 2016

Looks like these times it is safe to just look for an svg element with the proper namespace URL (https://phabricator.wikimedia.org/T43174), PR: #677

christianjgreen pushed a commit to fanhero/thumbor that referenced this pull request Aug 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants