Skip to content

Commit 842435f

Browse files
committed
Use antialiasing when comparing pdf files
Render at 600dpi and scale down to 150dpi.
1 parent 759765c commit 842435f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/matplotlib/testing/compare.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def get_file_hash(path, block_size=2 ** 20):
5656

5757
if Path(path).suffix == '.pdf':
5858
sha256.update(str(mpl._get_executable_info("gs").version).encode('utf-8'))
59+
sha256.update(b"r600") # invalidate old cache entries
5960
elif Path(path).suffix == '.svg':
6061
sha256.update(str(mpl._get_executable_info("inkscape").version).encode('utf-8'))
6162

@@ -112,7 +113,12 @@ def __call__(self, orig, dest):
112113
if not self._proc:
113114
self._proc = subprocess.Popen(
114115
[mpl._get_executable_info("gs").executable,
115-
"-dNOSAFER", "-dNOPAUSE", "-dEPSCrop", "-sDEVICE=png16m"],
116+
"-dNOSAFER",
117+
"-dNOPAUSE",
118+
"-dEPSCrop",
119+
"-sDEVICE=png16malpha",
120+
"-r600",
121+
"-dDownScaleFactor=4"],
116122
# As far as I can see, ghostscript never outputs to stderr.
117123
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
118124
try:

0 commit comments

Comments
 (0)