Ele funciona todo via terminal, mas para ficar mais amigável, estou usando o zenity e a notificação do Ubuntu.
Dependências:
-Zenity
-Imagemagick
-Libnotify-bin
#!/bin/bash
#Código original por cmisip ( http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=12543&start=0 )
#
#Adaptado por Kamei Hyoga do fórum Ubuntu-br ( http://ubuntuforum-br.org/index.php/topic,71626.0.html )
#
#Dependências:
#-Imagemagick
#-Zenity
#-Libnotify-bin
diretorio=$(zenity --file-selection --directory --title="IMG3d - Selecione o diretório que contém as fotos")
cd $diretorio
mkdir 3D 2>/dev/null
for img in *[.jpg,.jpeg,.JPG,.JPEG,.png,.PNG] ;
do
saida=$img
convert $img -set option:distort:viewport -24-0 -virtual-pixel tile -distort SRT 0 +repage $saida-right
convert $img -set option:distort:viewport +24-0 -virtual-pixel tile -distort SRT 0 +repage $saida-left
convert $saida-left -gravity east -chop 24x0 $saida-leftA
convert $saida-right -chop 24x0 $saida-rightA
convert $saida-leftA -level 0%,100%,1.2 $saida-leftAAA
convert $saida-rightA -level 0%,100%,1.0 $saida-rightAAA
convert $saida-leftAAA -channel r -fx '+u.r*0 + u.g*0.66 + u.b*0.33' -channel g -fx '+u.r*0 + u.g*0 + u.b*0' -channel b -fx '+u.r*0 + u.g*0 + u.b*0' $saida-red-left-RGB
convert $saida-rightAAA -channel R -fx 0 $saida-cyan-right-RGB
convert $saida-leftA -channel r -recolor '0 .66 .33 0 0 0 0 0 0' -gamma 1.2 -separate "(" $saida-rightA -channel gb -separate ")" -channel rgb -combine 3D/$saida
rm $saida-*
done
notify-send -t 100 "IMG3d:" "Todas as imagens convertidas. Aguarde o gerenciador de arquivos abrir" && sleep 3 && gnome-open $diretorio/3D
Ao executar o script, uma janela se abrirá para você selecionar a pasta que contém as imagens que quer converter. Depois de selecionada, o script começa a trabalhar e ao final o Nautilus será aberto no diretório das imagens originais.
Agora resta saber se essas imagens ficaram boas mesmo, porque ainda não fiz meu óculos 3D. Se alguém puder rodar esse script e testar as imagens, eu ficaria agradecido.