Difference between revisions of "ImageMagick"
Jump to navigation
Jump to search
(Created page with "'''ImageMagick''' is a common image processing program (<code>convert</code>) and library (e.g. PerlMagick, aka <code>Image::Magick</code>). ==PerlMagick snippets== ===Use m...") |
|||
| Line 1: | Line 1: | ||
'''ImageMagick''' is a common image processing program (<code>convert</code>) and library (e.g. PerlMagick, aka <code>Image::Magick</code>). | '''ImageMagick''' is a common image processing program (<code>convert</code>) and library (e.g. PerlMagick, aka <code>Image::Magick</code>). | ||
| − | == | + | ==Snippets== |
| − | === | + | ===Composite=== |
| + | |||
| + | <syntaxhighlight lang=bash> | ||
| + | composite -compose dst_over bg.png fg.png fg_on_bg.png | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | <syntaxhighlight lang=perl> | ||
| + | my $fg_on_bg = $fg->Clone; # or just $fg, if destructive | ||
| + | $fg_on_bg->Composite(compose => 'dst_over', image => $bg); | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | ===New image filled with color=== | ||
| + | |||
| + | <syntaxhighlight lang=bash> | ||
| + | export COLOR=white | ||
| + | export WIDTH=800 | ||
| + | export HEIGHT=600 | ||
| + | convert -size ${WIDTH}x${HEIGHT} xc:${COLOR} filled.png | ||
| + | </syntaxhighlight> | ||
<syntaxhighlight lang=perl> | <syntaxhighlight lang=perl> | ||
| − | + | my $color = 'white'; | |
| + | my $width = 800; | ||
| + | my $height = 600; | ||
| + | my $filled = new Image::Magick size => "${width}x${height}"; | ||
| + | $filled->Read("xc:$color"); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 07:50, 2 January 2015
ImageMagick is a common image processing program (convert) and library (e.g. PerlMagick, aka Image::Magick).
Snippets
Composite
composite -compose dst_over bg.png fg.png fg_on_bg.png
my $fg_on_bg = $fg->Clone; # or just $fg, if destructive
$fg_on_bg->Composite(compose => 'dst_over', image => $bg);
New image filled with color
export COLOR=white
export WIDTH=800
export HEIGHT=600
convert -size ${WIDTH}x${HEIGHT} xc:${COLOR} filled.png
my $color = 'white';
my $width = 800;
my $height = 600;
my $filled = new Image::Magick size => "${width}x${height}";
$filled->Read("xc:$color");