Skip to content

Commit 979002f

Browse files
authored
Baxpr pdf - remove convert dependency (#498)
* getpage * remove convert dependency * fix variable name * Fix ordering of vars, and also fix Xnatupload
1 parent 4869d13 commit 979002f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

bin/Xnat_tools/Xnatupload

+3-3
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,8 @@ def generate_previews(ra_dict):
322322
"""
323323
_format = ' Warning: generate_previews -- %s -- %s'
324324
cmd_o = 'gs -q -o "%s" -sDEVICE=pngalpha -dLastPage=1 "%s"'
325-
cmd_p = 'convert "%s" -resize x200 "%s"'
326-
325+
#cmd_p = 'convert "%s" -resize x200 "%s"'
326+
cmd_p = 'gs -q -o "%s" -sDEVICE=pngalpha -dLastPage=1 -dDEVICEHEIGHTPOINTS=200 -dDEVICEWIDTHPOINTS=200 -dFitPage "%s"'
327327
for label, resource_dict in list(ra_dict.items()):
328328
if 'PDF' in list(resource_dict.keys()):
329329
pdf_path = check_pdf_path(resource_dict['PDF'], label)
@@ -346,7 +346,7 @@ def generate_previews(ra_dict):
346346
snapshot_preview = os.path.join(tmp_path, SNAPSHOT_P)
347347

348348
# Make the snapshot_thumbnail
349-
os.system(cmd_p % (snapshot_original, snapshot_preview))
349+
os.system(cmd_p % (snapshot_preview, snapshot_original))
350350

351351
if not os.path.exists(snapshot_original) or \
352352
not os.path.exists(snapshot_preview):

dax/dax_tools_utils.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@
6161

6262
# Cmd:
6363
GS_CMD = """gs -q -o {original} -sDEVICE=pngalpha -dLastPage=1 {pdf_path}"""
64-
CONVERT_CMD = """convert {original} -resize x200 {preview}"""
64+
#CONVERT_CMD = """convert {original} -resize x200 {preview}"""
65+
CONVERT_CMD = """gs -q -o {preview} -sDEVICE=pngalpha -dLastPage=1 -dDEVICEHEIGHTPOINTS=200 -dDEVICEWIDTHPOINTS=200 -dFitPage {original}"""
6566
GS_CMD2 = """gs -q -o {original} -sDEVICE=pngalpha {pdf_path}"""
6667

6768
# WARNING content for emails

0 commit comments

Comments
 (0)