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

Fix SVG resize in cairosvg and inkscape builder #184

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

L3o-pold
Copy link
Contributor

No description provided.

Copy link
Contributor

@inkhey inkhey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, Thank for this contribution.
I'm not sure to understand what this PR does.
Does this preserve image ratio ?

@raphj
Copy link
Contributor

raphj commented Jul 15, 2020

@L3o-pold ping.

I haven't reviewed this PR. Can you provide us with some insight on this PR so we can review it in the best conditions? What problem are you solving?

@L3o-pold
Copy link
Contributor Author

@inkhey it depends on how cairosvg.svg2png handle ratio.

It prevents deforming svg. You can try to before/after with an svg icon for example. Before the patch if you ask a big size it will not be extended as it should.

@inkhey
Copy link
Contributor

inkhey commented Jul 16, 2020

Just tested with or without this patch:
test_result.zip

For cairosvg:

  • Based on svg "view"
  • Preserve ratio, if ratio doesn't match file size, will change the view and also show elements outside of the "standard" view.

For inkscape:

  • Based on drawing view.
  • setting both height and width make inkscape don't preserve ratio anymore.

Not sure what should be the correct behavior here.

@L3o-pold
Copy link
Contributor Author

@inkhey you can see that with patch file svg_tesselation_test_inkscape1 and svg_tesselation_test_inkscape2.jpg are much better with the patch.

@inkhey
Copy link
Contributor

inkhey commented Jul 16, 2020

@inkhey you can see that with patch file svg_tesselation_test_inkscape1 and svg_tesselation_test_inkscape2.jpg are much better with the patch.

As behavior are unclear, i will create an issue to make decision.
I do think new behavior with cairosvg is ok but i do not like the fact that ratio is not preserved in inkscape file.

As we will not fix the fully problem here (should we use view or drawing view, what about some person that do need not preserving ratio), i suggest you to fix inkscape builder in a way ratio is preserved. A not perfect but nice enough solution may be setting only height or width, as inkscape does not provide command line out of the box to do so.
If this is ok, i will merge this.

@inkhey
Copy link
Contributor

inkhey commented Jun 25, 2021

Inkscape issue is https://gitlab.com/inkscape/inbox/-/issues/2111 related.

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.

3 participants