Discussion:
[gentoo-user] Off topic: - imagemagic command line, strange behaviour
(too old to reply)
t***@sys-concept.com
2023-12-29 02:50:01 UTC
Permalink
I'm trying to remove grey background from a pdf file, but on windows.
The document contains some grey scale fonts that I want to retain.

Running on windows, via Command line:
magick convert -density 300 document.pdf -fuzz 45% -fill white +opaque black converted_document.pdf

Works, the text is retained including grey-scale font.

But running same command from a bat file, the grey-scale font is removed.

@echo off
cd "C:\Users\Server\Desktop\"
magick convert -density 300 document.pdf -fuzz 45% -fill white +opaque black converted_document.pdf
pause
--
Thelma
Florian Gamböck
2024-01-03 16:20:01 UTC
Permalink
Post by t***@sys-concept.com
@echo off
cd "C:\Users\Server\Desktop\"
magick convert -density 300 document.pdf -fuzz 45% -fill white +opaque black converted_document.pdf
pause
Just a wild guess without looking too deep into it: Might the "%" be a
special character in a Batch file, being interpreted as some sort of
variable? Can you escape it, maybe putting the whole "45%" in quotes?

Kind regards

FloGa
t***@sys-concept.com
2024-01-03 19:00:02 UTC
Permalink
Post by t***@sys-concept.com
@echo off
cd "C:\Users\Server\Desktop\"
magick convert -density 300 document.pdf -fuzz 45% -fill white +opaque black converted_document.pdf
pause
Just a wild guess without looking too deep into it: Might the "%" be a special character in a Batch file, being interpreted as some sort of variable? Can you escape it, maybe putting the whole "45%" in quotes?
Kind regards
FloGa
I got this one.
Yes, you are correct changing "45%" to "45%%" solved the problem.
Loading...