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

Allow SVG for image comparison #62

Closed
astrofrog opened this issue Oct 12, 2017 · 2 comments · Fixed by #194
Closed

Allow SVG for image comparison #62

astrofrog opened this issue Oct 12, 2017 · 2 comments · Fixed by #194

Comments

@astrofrog
Copy link
Collaborator

astrofrog commented Oct 12, 2017

With PNG output depending on both Matplotlib and Freetype version, I was wondering whether it would make sense to use the new features in Matplotlib that allow deterministic SVG files (https://matplotlib.org/users/whats_new.html#reproducible-ps-pdf-and-svg-output) to do the comparison with SVG files instead.

Of course, the idea of a 'tolerance' would be trickier to define here and I think we'd simply need to require images to match exactly, but at least the output should depend only on Matplotlib version (and the package being tested) and not on other libraries such as Freetype (if we ignore LaTeX). Using SVG files would also make it easier to keep reference image files in a repo since any diffs over time will be smaller. Of course we could keep support for PNG plots, but I'm suggesting adding a format option so that projects that want to use SVG could do that instead.

Another option would be to generate and store images as SVG files but rasterize them for the image comparison, though presumably this will again depend on the version of the library used for the rasterization.

@dopplershift @tacaswell - do you have any thoughts on this? Do you see any downsides with some packages doing the comparison in SVG space instead of with PNG files? Are there likely to be frequent changes to the SVG output without actual noticeable changes?

Just to clarify, this would assume that Matplotlib itself tests that the SVG and PNG output are consistent and that we don't have to test all formats in every package (to some extent we do this currently with packages that use pytest-mpl - we only check PNG output and assume SVG is fine)

@astrofrog astrofrog changed the title Using SVG for image comparison Allow SVG for image comparison Oct 12, 2017
@dopplershift
Copy link
Contributor

I thought matplotlib still used freetype to convert text to paths for SVG?

@astrofrog
Copy link
Collaborator Author

Ah ok, then that doesn't really help

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 a pull request may close this issue.

3 participants