Page 1 of 1

Cheese's "dice" effect

Posted: 2016-10-08T12:07:48-07:00
by miktoki
Cheese(https://wiki.gnome.org/Apps/Cheese) is a gnome software for webcams. It has some interesting effects including the "dice" effect. Is there something similar in IM?

I tried looking for something similar in imagemagick to apply on already captured images but did not find it.

Re: Cheese's "dice" effect

Posted: 2016-10-08T12:15:36-07:00
by snibgo
Following your link did not take me to any examples or descriptions of those "interesting effects".

Re: Cheese's "dice" effect

Posted: 2016-10-08T13:04:29-07:00
by Bonzo
I think I found some examples on Google images and I would say you will have to write your own Imagemagick code for most of the effects.

Some of the simpler effects are built into Imagemagick; see this page

Re: Cheese's "dice" effect

Posted: 2016-10-08T14:37:59-07:00
by fmw42
I do not know what effects are provided by cheese. Perhaps you could provide a link to some examples.

In the meantime, if you are on Linux, Mac OSX, Windows w/Cygwin or Windows 10, see my bash unix imagemagick scripts at the link below.

EDIT: OK, I found some similar examples here http://effectv.sourceforge.net/

Re: Cheese's "dice" effect

Posted: 2016-10-08T18:47:24-07:00
by fmw42
Here is some Unix-based code to produce the dice effect. It is a bit slow. It took about 15s on my Mac Mini INTEL duo-core vintage 2010.

Input:
Image

Code: Select all

infile="lena.jpg"
inname=`convert "$infile" -format "%t" info:`
dim=16
wh=`convert -ping "$infile" -format "%wx%h" info:`
ww=`echo "$wh" | cut -dx -f1`
hh=`echo "$wh" | cut -dx -f2`
ww=`convert xc: -format "%[fx:$dim*floor($ww/$dim)]" info:`
hh=`convert xc: -format "%[fx:$dim*floor($hh/$dim)]" info:`
numw=$((ww/dim))
numh=$((hh/dim))
num=$((numw*numh))
#echo "numw=$numw; numh=$numh; num=$num;"
convert "$infile" -crop ${ww}x${hh}+0+0 +repage -crop ${dim}x${dim} tmp.miff
(
for ((i=0; i<num; i++)); do
rand=`convert xc: -format "%[fx:round(3*random())]" info:`
angle=$((rand*90))
#echo >&2 "$i; $rand; $angle"
convert tmp.miff[$i] -rotate $angle miff:-
done
) | montage - -tile ${numw}x${numh} -geometry +0+0 "${inname}_dice.jpg"
rm -f tmp.miff
Image

I will make a formal script for this shortly.

Re: Cheese's "dice" effect

Posted: 2016-10-09T00:03:56-07:00
by miktoki
Wow, looks great,

Thanks
fmw42 wrote:Here is some Unix-based code to produce the dice effect. It is a bit slow. It took about 15s on my Mac Mini INTEL duo-core vintage 2010.

Input:
Image

Code: Select all

infile="lena.jpg"
inname=`convert "$infile" -format "%t" info:`
dim=16
wh=`convert -ping "$infile" -format "%wx%h" info:`
ww=`echo "$wh" | cut -dx -f1`
hh=`echo "$wh" | cut -dx -f2`
ww=`convert xc: -format "%[fx:$dim*floor($ww/$dim)]" info:`
hh=`convert xc: -format "%[fx:$dim*floor($hh/$dim)]" info:`
numw=$((ww/dim))
numh=$((hh/dim))
num=$((numw*numh))
#echo "numw=$numw; numh=$numh; num=$num;"
convert "$infile" -crop ${ww}x${hh}+0+0 +repage -crop ${dim}x${dim} tmp.miff
(
for ((i=0; i<num; i++)); do
rand=`convert xc: -format "%[fx:round(3*random())]" info:`
angle=$((rand*90))
#echo >&2 "$i; $rand; $angle"
convert tmp.miff[$i] -rotate $angle miff:-
done
) | montage - -tile ${numw}x${numh} -geometry +0+0 "${inname}_dice.jpg"
rm -f tmp.miff
Image

I will make a formal script for this shortly.