ImageMagick

Contents

    Sources

    NOTE: mitigation of the following error

    convert-im6.q16: attempt to perform an operation not allowed by the security policy `PDF' @ error/constitute.c/IsCoderAuthorized/408.
    convert-im6.q16: no images defined `image.jpeg' @ error/convert.c/ConvertImageCommand/3258.
    

    Inside file /etc/ImageMagick-6/policy.xml
    Add the following line <policy domain="coder" rights="read|write" pattern="PDF" />

    File info

    identify -verbose <file>

    Naming

    Naming

    Pages restriction

    Quality, density and scale

    Quality → compression level
    quality documentation
    JPEG/MIFF/PNG compression level between 1 (bad quality) and 100 (high quality). Default value (92), 90 or 95 are good values.
    convert -quality 92 source.pdf[1] destination.jpeg

    Density → pixels per inch
    density documentation
    Without changing the size of the image, the density changes the number of pixels per inch. Higher density means higher number of pixels for the image. This option is useful to increase text readability. 72 (or 72x72) is the default.
    convert -density 72 source.pdf[1] destination.jpeg

    Resize → ...
    resize documentation
    convert large-square.jpeg -resize 150x150 small-square.jpeg

    Scale → ...
    scale documentation
    convert -scale

    Sample → ...
    sample documentation
    convert -sample resize which does NOT create new color. More compact even if less beautiful.

    Format conversion

    convert source.png destination.jpeg

    PNG background : remove alpha and replace with white
    convert raw-footage.png -background white -alpha remove -flatten -alpha off test1.jpeg

    Border

    convert source.jpeg -bordercolor white -border 50x30 destination.jpeg

    Turn transparency into white (NOT black!)

    flatten documentation
    Use -flatten parameter: convert source.pdf -flatten destination.jpeg

    90° rotation

    rotate documentation
    convert -rotate 90 source.jpeg destination.jpeg

    Crop file

    crop documentation

    Text printing on image file

    convert -size 300x12 -pointsize 9 label:"helloworld" fichier.png

    Image composition (one on top of the other)

    composite -compose Over -gravity NorthEast top.png bottom.jpeg result.jpeg


    Backlinks: Command line:pdf

    Proudly Powered by Zim 0.75.2.

    Template by Etienne Gandrille, based on ZeroFiveEight and using JQuery Toc Plugin.