Nexx
Nexx

Reputation: 61

How to obtain the image with the differences when using diff-pdf-visually?

I have installed the diff-pdf-visually tool from Github and I am using it in Visual Studio Code.

I ran it with python for 2 PDFs with:

from diff_pdf_visually import pdfdiff

pdfdiff("compareA.pdf", "compareB.pdf")

Then, I get this result:

Converting each page of the PDFs to an image...
PDFs have the same number of pages. Checking each pair of converted images...
Min sig = 15.2909, significant?=True. The PDFs are different. The most different pages are: page 1 (sgf. 15.2909). 
False

However, I cannot find the file containing the visual differences. On the Github page, it is mentioned that there are "temporary files" that include a PNG image with the differences per page.

How I can find the file with the visual differences in order to make use of it?

Upvotes: 1

Views: 899

Answers (2)

cchapman
cchapman

Reputation: 3367

While using the command line version of diff-pdf-visully there's an option to run with a verbose option by adding -v or --verbose which gave me the output of the temporary directory. I'm on a Mac, and the output was

$ diff-pdf-visually -v --time 600
  Temporary directory: /var/folders/st/2t5c6z1s4cq9krgnchvqy9_40000gq/T/diffpdf25vocw6l
  Converting each page of the PDFs to an image...
  PDFs have same number of pages. Checking each pair of converted images...
- Page 1: significance=31.6028
- Page 2: significance=inf
Min sig = 31.6028, significant?=True. The PDFs are different. The most different pages are: page 1 (sgf. 31.6028).

While it's not the exact usage as you described, hopefully there's a similar way to do it with your setup.

Upvotes: 0

K J
K J

Reputation: 11850

The temp files disappearance are controlled by optional [--time TIME] variable, thus may have been deleted when you look if the setting is not high enough.

However the latest brew should have an extra optional ability to hold the files in a given location. Unsure if that was in latest release (possibly not).

The fact that your using VC suggests your using Windows and the likely location is a sub-folder in the %temp% directory, so watch that whilst running a compare and you should see a new folder at time of invocation.

It thus may be in something like C:\Users\your name\AppData\Local\Temp\diffpdfbzfxlraz or at run time some tmp files may be in a work area and built as /tmp/diffpdfhkhuea_s

You need to watch for both as there are different worksets built by the chained poppler and imgmagick, not to mention python or any windows env setting. See the docs for upping --time to say 600 seconds, whilst you searching.

Upvotes: 1

Related Questions