I'm currently working with pictures and I try to do the same thing as the CSS filter below but in command line:
filter: invert(0.86) hue-rotate(180deg);
To do the trick I used imagemagick's convert tool.
convert $in -evaluate add -26% -negate -modulate 100,100,0 $out
I get close to the result I expect, but I have a huge quality drop. Let's show this in an example
Original version (a random jpg image)
Clean version (made with CSS, expected result)
Dirty one, made with convert
Is there any way (with this tool or another) to convert my image smoothly? The best would be to directly apply css to this image but I don't know whether it's possible in commandline...
If I do the following on the command line:
compare out1.png out2.png diff\out1.png
The diff image is very light and it's easy to spot the differences (even if they are only a couple of pixels).
I can't seem to get the same result using gm:
gm compare -colorspace GRAY -highlight-color red -verbose -file
diff\out1.png out1.png out2.png
This will have the red difference stick out a little but the resulting image is not transparent (alpha opacity?) like with the compare command. I think compare came from installing graphicsmagick so it uses gm but with what parameters?
[UPDATE]
I just found that compare.exe is from Imagemagic
The reason I needed this is because I was using gm with webdriverjs (selenium-webdriver for node) to compare my dev environment with the production/staging site.
Because gm.compare did not work with imagemagick I used graphicsmagick but solving the bug with gm was easier than trying to figure out how to use graphicsmagick.
So even though the actual question is not answered I solved the problem.
Maybe I'll turn this question into a wiki for webdriverjs.
In ImageMagick, I can do "Duotone" effect by following command,
convert rose_grey.jpg -fill blue -tint 100 rose_blue.jpg
But in GraphicsMagick, it doesn't work.
I am stuck: How to do it? Thanks.
I want to convert an input 8-bit PNG image to 8 bit.
I have tried using GraphicsMagick. But I don't know how to convert png8 in GraphicsMagick.
When I use the command as such:
gm convert source.png png8:output.png
it return the message
gm convert: Invalid background palette index (output.png).
My version is GraphicsMagick 1.3.20 2014-08-16 Q8 .
Try using the "-colors 254" option, e.g.,
gm convert source.png -colors 254 png8:output.png
The "png8:" color reduction is somewhat quick-and-dirty and doesn't do nearly as good a job as the slower -colors option, with either GraphicsMagick or ImageMagick.
How can you pick pages from a PDF file?
Pseudo-code synopsis
pick-pages 1,2-69,70-73,100 example.pdf > put_to_new_file.pdf
My best suggestion would be to try something with PDF toolkit - with Split and Merge, and a simple .bat file construction, something like that shouldn't be much hard.
ghostscript, somethign like
gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -dFirstPage=3 -dLastPage=3 -sOutputFile=fileout.pdf filein.pdf
This is how I've done it with regular expressions. I counted the number of matches for the following regular expressions:
/Type\s*/Page[^s]
Case insensitive, by the way.
You're after pdftk.
Probably this is not a popular method, but this is one way. You can use pdflatex. For example, you can write a tex like:
\documentclass{book}\usepackage{pdfpages}\begin{document}
\includepdf[pages={1,2-10,11}]{pdf.pdf}\end{document}
You can write a small script to automize this.
As part of my CAM::PDF Perl library on CPAN, I bundle a command-line utility deletepdfpage.pl that does the inverse of what you are asking for, with almost the exact same syntax:
deletepdfpage.pl original.pdf 74-99,101- target.pdf