convert command with noise overlay
Posted: 2019-05-24T10:38:49-07:00
Ubuntu 18.04
ImageMagick 6.9.7-4 x86_64
PHP
I have some code to develop some colored blocks, but I'd like to add a bit of texture. I don't want to use a script, I just want to do it in one line. So I'm thinking just add a little noise with lowered opacity as an overlay.
The code looks like this now.
exec('convert -font Times-Bold -pointsize 24 -gravity center -fill "rgba(0,0,0,0.40)" \
\( -size 1x25 xc:#000000 \) \
\( -size 1x25 xc:#' . $this->_m->random_color() . ' \) \
\( -size 1x25 xc:#000000 \) \
\( -size 25x25 xc:#'. $dot_colors[$r1] .' -annotate +0+2 \''.$dot_txt[$r1].'\' \) \
\( -size 1x25 xc:#000000 \) \
\( -size 1x25 xc:#' . $this->_m->random_color() . ' \) \
\( -size 1x25 xc:#000000 \) \
\( -size 25x25 xc:#'. $dot_colors[$r2] .' -annotate +0+2 \''.$dot_txt[$r2].'\' \) \
\( -size 1x25 xc:#000000 \) \
\( -size 1x25 xc:#' . $this->_m->random_color() . ' \) \
\( -size 1x25 xc:#000000 \) \
\( -size 25x25 xc:#'. $dot_colors[$r3] .' -annotate +0+2 \''.$dot_txt[$r3].'\' \) \
\( -size 1x25 xc:#000000 \) \
\( -size 1x25 xc:#' . $this->_m->random_color() . ' \) \
\( -size 1x25 xc:#000000 \) \
+append /tmp/capimg.png');
How could I add a noise layer to it with say 20% opacity? Ignore the php variables, they are just arrays for color and text.
The noise or maybe plasma:fractal overlay would have to start at the top left of the created image. I assume the code would come after the append?
Thanks.
ImageMagick 6.9.7-4 x86_64
PHP
I have some code to develop some colored blocks, but I'd like to add a bit of texture. I don't want to use a script, I just want to do it in one line. So I'm thinking just add a little noise with lowered opacity as an overlay.
The code looks like this now.
exec('convert -font Times-Bold -pointsize 24 -gravity center -fill "rgba(0,0,0,0.40)" \
\( -size 1x25 xc:#000000 \) \
\( -size 1x25 xc:#' . $this->_m->random_color() . ' \) \
\( -size 1x25 xc:#000000 \) \
\( -size 25x25 xc:#'. $dot_colors[$r1] .' -annotate +0+2 \''.$dot_txt[$r1].'\' \) \
\( -size 1x25 xc:#000000 \) \
\( -size 1x25 xc:#' . $this->_m->random_color() . ' \) \
\( -size 1x25 xc:#000000 \) \
\( -size 25x25 xc:#'. $dot_colors[$r2] .' -annotate +0+2 \''.$dot_txt[$r2].'\' \) \
\( -size 1x25 xc:#000000 \) \
\( -size 1x25 xc:#' . $this->_m->random_color() . ' \) \
\( -size 1x25 xc:#000000 \) \
\( -size 25x25 xc:#'. $dot_colors[$r3] .' -annotate +0+2 \''.$dot_txt[$r3].'\' \) \
\( -size 1x25 xc:#000000 \) \
\( -size 1x25 xc:#' . $this->_m->random_color() . ' \) \
\( -size 1x25 xc:#000000 \) \
+append /tmp/capimg.png');
How could I add a noise layer to it with say 20% opacity? Ignore the php variables, they are just arrays for color and text.
The noise or maybe plasma:fractal overlay would have to start at the top left of the created image. I assume the code would come after the append?
Thanks.