You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
The text was updated successfully, but these errors were encountered:
astrofrog
changed the title
Using SVG for image comparison
Allow SVG for image comparison
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)
The text was updated successfully, but these errors were encountered: