Comparing pdf output in tests

I am thinking about adding pdf comparison ability to compare_images. One
simple way to do this would be to convert pdf files to pngs using
Ghostscript: if we store reference pdf files, and both the reference
file and the result of the test are converted using with exactly the
same version of gs, there should be no font-rendering or antialiasing
mismatches.

Can we assume that all test computers will have some version of
Ghostscript installed and callable as "gs"?

···

--
Jouni K. Sepp�nen
http://www.iki.fi/jks

Jouni K. Sepp�nen wrote:

I am thinking about adding pdf comparison ability to compare_images. One
simple way to do this would be to convert pdf files to pngs using
Ghostscript: if we store reference pdf files, and both the reference
file and the result of the test are converted using with exactly the
same version of gs, there should be no font-rendering or antialiasing
mismatches.

Can we assume that all test computers will have some version of
Ghostscript installed and callable as "gs"?
  

We can probably standardize the version of gs on the buildbot machines, but it's been very useful up to now to have tests that can run on a variety of developer machines as well.

I don't know how different the output will be from different versions of gs -- maybe we should just try it and see. I have a pretty old version of gs on my RHEL4 box (7.07). If you want me to send you a png of a particular pdf to directly compare with yours before you even start with the test infrastructure, I'm happy to do that.

Mike

···

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Michael Droettboom wrote:

Jouni K. Seppänen wrote:
  

I am thinking about adding pdf comparison ability to compare_images. One
simple way to do this would be to convert pdf files to pngs using
Ghostscript: if we store reference pdf files, and both the reference
file and the result of the test are converted using with exactly the
same version of gs, there should be no font-rendering or antialiasing
mismatches.

Can we assume that all test computers will have some version of
Ghostscript installed and callable as "gs"?
  

We can probably standardize the version of gs on the buildbot machines,
but it's been very useful up to now to have tests that can run on a
variety of developer machines as well.

I don't know how different the output will be from different versions of
gs -- maybe we should just try it and see. I have a pretty old version
of gs on my RHEL4 box (7.07). If you want me to send you a png of a
particular pdf to directly compare with yours before you even start with
the test infrastructure, I'm happy to do that.
  

I understood Jouni's idea to be to save the .pdfs as baseline images --
then the same version of gs would be used to generated the rasterized
images for the baseline and test result -- the version on your computer.
I think this is the way to go (either that or compare the PDFs directly
somehow).

Anyhow, allowing the test infrastructure to support testing multiple
backends is why I removed file extensions from the test image name in
the first place, so anything along these lines should hopefully be quite
doable. We could add a keyword arg to the image comparison decorator
that specified which image formats to test. Alternatively, it could
perform comparisons based on the presence baseline images of known
extensions.

-Andrew

Jouni K. Seppänen wrote:

I am thinking about adding pdf comparison ability to compare_images. One
simple way to do this would be to convert pdf files to pngs using
Ghostscript: if we store reference pdf files, and both the reference
file and the result of the test are converted using with exactly the
same version of gs, there should be no font-rendering or antialiasing
mismatches.

Can we assume that all test computers will have some version of
Ghostscript installed and callable as "gs"?

Hi Jouni,

Sorry for not noticing this earlier, but I'm looking in the baseline image directory, and I see a bunch of *_pdf.png files. I guess these have been convered to png from pdf on the tester's machine. Do you think it makes more sense to have the .pdf files in the test repo and convert to png at test run time? This way we don't become dependent on gs rendering quirks or differences across pdf renderers. Maybe the files are also smaller.

-Andrew