Programming.ImageMagick History

Hide minor edits - Show changes to output - Cancel

March 02, 2014, at 10:43 PM by MichaelPaulukonis -
Added lines 98-99:
See Also: [[GIF]]
July 13, 2011, at 09:35 AM by OtherMichael -
Added lines 101-102:
July 13, 2011, at 09:33 AM by OtherMichael -
Added line 7:
[[|Supported image formats]]
July 13, 2011, at 09:30 AM by OtherMichael -
Added lines 15-18:

July 12, 2011, at 09:31 PM by OtherMichael -
Added lines 1-98:
!! Image Processing tool-kit
Stack Overflow: [[|questions tagged 'ImageMagick']]

!! Installation
install from

Make sure it's early-enough in your PATH environment variable, as there is windows cmd [@CONVERT@] -- one will have to clobber the other.

If the environment variable stops working (it was fine one minute, stopped the next) you'll get errors like "Invalid Parameter - -monochrome".  I ended up specifying the full path to the convert.exe file until I can get it working again.

!!! weird errors
(:source lang=text:)
Can't load 'C:/Perl/site/lib/auto/Image/Magick/Magick.dll' for module Image::Magick: load_file:
This application has failed to start because the application configuration is incorrect.
Reinstalling the application may fix this problem at C:/Perl/lib/ line 201. at C:\Program Files\ line 18
Compilation failed in require at C:\Program Files\ line 18.
BEGIN failed--compilation aborted at C:\Program Files\ line 18.

Solution: installed the Microsoft Visual C++ 2008 Redistributable:

If you have trouble installing try installing this first: Attach:vcredist_x86.ZIP (also available from the IM installation page)

!!! Perl components
If you want to use the [@PerlMagick@] component, make sure that Perl is installed '''first.'''

Also, check the appropriate boxes:
(:toggle id="tog1259965147528" show="Show install options" init=hide button=1:)
(:div1259965147528 id="tog1259965147528" style="border:1px solid #999; padding:5px;":)

post-install, you should see folders like [@c:\perl\site\lib\Image@] and [@c:\perl\site\lib\auto\Image\Magick\@]

!!! Ghostscript for [=PDFs=]
If you're going to convert [=PDFs=], you need to have GhostScript installed, as well.

(:toggle id="tog1256678896696" show="Show GS-not-installed error" init=hide button=1:)
(:div1256678896696 id="tog1256678896696" style="border:1px solid #999; padding:5px;":)
[@convert -density 200 -compress lzw -type bilevel \path\to\ForConversion\TempConversion\temp.pdf temp.tif
convert: `%s': %s "gswin32c.exe" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignToPixels=0 -dGridFitTT=0 "-sDEVICE=pnmraw" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r200x200"  "-sOutputFile=C:/DOCUME~1/MICHAE~1/LOCALS~1/Temp/magick-_9nmWZZK" "-fC:/DOCUME~1/MICHAE~1/LOCALS~1/Temp/magick-gOgISD3g" "-fC:/DOCUME~1/MICHAE~1/LOCALS~1/Temp/magick-lS6IAndt"
@ utility.c/SystemCommand/1963.
convert: Postscript delegate failed `\path\to\TempConversion\temp.pdf': No
such file or directory @ pdf.c/ReadPDFImage/634.
convert: missing an image filename `temp.tif' @ convert.c/ConvertImageCommand/2838.@]

!! Uses too much disk space
wWhen processing a large document, umpteen tem files are written ... to the temp/tmp directory. If you hard-drive is near capacity and the tmp folder fills up, processing will quit unexpectedly (although all tmp files will be deleted at that point). In my case, "near" was 16Gigabytes (I was processing a 800,000 MB file).

But you can temporarily change the tmp directory to another drive, if you have one:

(:source lang=text:)
SET TMP=e:\tmp
SET TEMP=e:\tmp

!! Misc commands
!!! Convert multi-page to single-page

[@convert multi-page.tif single-page%03d.tif@]

[@%03d@] is a standard [@printf@] formatting code

!! Text conversion

[@convert text:SampleSubject.eml sample.tif@]

This command line works for text files. Replace 200974281 with whatever you need.
Outputs a 1 bit per pixel, 200dpi, but not G4 compressed tiff.  Quality is not awesome.  Note the full path to convert.exe is not needed if your environment variable is working properly.
[@convert.exe text:200974281.txt -monochrome  -type  bilevel  -resample 200x200 200974281.tif@]

Had to add the compress option to get G4s:
(:source lang=text:)
convert.exe text:200974281.txt -monochrome -compress group4 -type  bilevel  -resample 200x200 200974281.tif

!! Animated GIF

!! [[#SeeAlso]] See Also

!! [[#Categories]] Category tags
[[!Programming]] [[!imageConversion]]