Conditional -negate pdf file

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Squashed
Posts: 9
Joined: 2018-09-26T15:59:57-07:00
Authentication code: 1152

Re: Conditional -negate pdf file

Post by Squashed »

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 22, but even with no operation imagemagick made that color 29. Any ideas why?
Squashed
Posts: 9
Joined: 2018-09-26T15:59:57-07:00
Authentication code: 1152

Re: Conditional -negate pdf file

Post by Squashed »

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 22, but even with no operation imagemagick made that color 29. Any ideas why?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Conditional -negate pdf file

Post by snibgo »

Squashed wrote:... the background color was 22...
What does that mean? Where did that information come from?
snibgo's IM pages: im.snibgo.com
Squashed
Posts: 9
Joined: 2018-09-26T15:59:57-07:00
Authentication code: 1152

Re: Conditional -negate pdf file

Post by Squashed »

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 black point threshold. 22/255 = 8.6%, 29/255 = 11.4%, so setting it at 15% should be safe. Initially I had it at 10% and there was no change in the background values, which confused me. But I just wondered why the difference?
Post Reply