Skip to content

Commit

Permalink
fix backslash for windows in convert call
Browse files Browse the repository at this point in the history
  • Loading branch information
virantha committed Dec 8, 2014
1 parent d12b411 commit f9dd010
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pypdfocr/pypdfocr_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,20 @@ def _run_preprocess(self, in_filename):
basename, filext = os.path.splitext(in_filename)
out_filename = '%s_preprocess%s' % (basename, filext)
#-respect-parenthesis \( -clone 0 -colorspace gray -negate -lat 15x5+5% -contrast-stretch 0 \) -compose copy_opacity -composite -opaque none +matte -modulate 100,50 -adaptive-blur 2.0 -sharpen 0x1
# When using Windows, can't use backslash parenthesis in the shell, so omit the backslash
if str(os.name) == 'nt':
backslash = ''
else:
backslash = '\\'

c = ['convert',
'"%s"' % in_filename,
'-respect-parenthesis',
#'\\( $setcspace -colorspace gray -type grayscale \\)',
'\\(',
backslash+'(',
'-clone 0',
'-colorspace gray -negate -lat 15x15+5\% -contrast-stretch 0 \\) -compose copy_opacity -composite -opaque none +matte -modulate 100,100',
'-colorspace gray -negate -lat 15x15+5\% -contrast-stretch 0',
backslash+') -compose copy_opacity -composite -opaque none +matte -modulate 100,100',
#'-adaptive-blur 1.0',
'-blur 1x1',
#'-selective-blur 4x4+5%',
Expand Down

0 comments on commit f9dd010

Please sign in to comment.