Search found 9 matches

by Squashed
2018-09-28T14:54:16-07:00
Forum: Users
Topic: Conditional -negate pdf file
Replies: 18
Views: 11356

Re: Conditional -negate pdf file

I opened the pdf in photoshop and hovered over the background color, ie non-text area, and viewed the rgb values in the info window. They read r=22,g=22,b=22. After running magick input.pdf output.pdf, I examined output.pdf in the same way and read r=29,g=29,b=29. I just want to know where to set my...
by Squashed
2018-09-28T12:58:44-07:00
Forum: Users
Topic: Conditional -negate pdf file
Replies: 18
Views: 11356

Re: Conditional -negate pdf file

Having thought about it some more, I decided instead to use -black-threshold "%%[fx:mean<0.5?15:0]%%" before -level so that I could avoid using a variable. This way the background is set to black before inverting it to white. One confusing issue, before conversion the background color was ...
by Squashed
2018-09-28T12:56:30-07:00
Forum: Users
Topic: Conditional -negate pdf file
Replies: 18
Views: 11356

Re: Conditional -negate pdf file

Having thought about it some more, I decided instead to use -black-threshold "%%[fx:mean<0.5?15:0]%%" before -level so that I could avoid using a variable. This way the background is set to black before inverting it to white. One confusing issue, before conversion the background color was ...
by Squashed
2018-09-27T11:04:06-07:00
Forum: Users
Topic: Conditional -negate pdf file
Replies: 18
Views: 11356

Re: Conditional -negate pdf file

That does it. Thanks very much for all your help.
by Squashed
2018-09-27T08:44:49-07:00
Forum: Users
Topic: Conditional -negate pdf file
Replies: 18
Views: 11356

Re: Conditional -negate pdf file

Ok that works now, thanks.

One last issue - the level command seems to cause a problem with the anti-aliasing. I noticed the output pdf has reduced image dimensions and file size. Not sure why?
by Squashed
2018-09-27T06:33:43-07:00
Forum: Users
Topic: Conditional -negate pdf file
Replies: 18
Views: 11356

Re: Conditional -negate pdf file

Thank you GeeMack, I'm getting close now. I have: magick input.pdf -channel RGB -level "%%[fx:mean<0.5?100:0]%%" output.pdf which negates only the dark pages. Only one parameter needed for level, since white point is the opposite of black point. However, I also wanted to add -white-thresho...
by Squashed
2018-09-26T20:12:21-07:00
Forum: Users
Topic: Conditional -negate pdf file
Replies: 18
Views: 11356

Re: Conditional -negate pdf file

I'm getting an error:

convert: invalid argument for option '-level': %[fx:mean<0.5?100:0]% @ error/convert.c/ConvertImageCommand/2003.

Can fx be used to supply an argument for level? Or am I not formatting it correctly? Trying it manually on command line for now.
by Squashed
2018-09-26T17:34:56-07:00
Forum: Users
Topic: Conditional -negate pdf file
Replies: 18
Views: 11356

Re: Conditional -negate pdf file

In a batch file I'm using:

magick convert %1 -alpha deactivate -negate -white-threshold 85%% "%~dpn1_negated%~x1"

which inverts all the pages of the input.pdf to the output.pdf
by Squashed
2018-09-26T16:09:48-07:00
Forum: Users
Topic: Conditional -negate pdf file
Replies: 18
Views: 11356

Conditional -negate pdf file

I'm trying to convert a pdf where some pages have white text on dark background. I can successfully convert single pages using -negate, but how can I conditionally process all pages, only converting those with a dark background? IM 7.0.7-Q16 on Win 10 64bit. Many thanks.