mercredi 15 septembre 2010

Mettre un stamp sur une image

Avec convert (de Imagemagick), fonctionne bien avec la version :

$convert --version
Version: ImageMagick 6.5.7-8 2009-11-26 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC
Features: OpenMP



#!/bin/bash
# stamp timbre A_marquer Img_finale

# (c) 2007-2010 by C.M.
# under the GPL License

# prendre deux fichiers d'images
# l'un étant un "sceau" et l'autre une photo
# et marquer la photo du sceau, en bas à droite (ou gauche)
# Image timbre
SCEAU="$1"
# Image à marquer
PIC="$2"
# Fichier de sortie
OUT_IMAGE="$3"
# Proportion du timbre par rapport à l'image
SCALE="/ 20"


# dimensions de l'image à marquer
width_pic=`identify -format %w "$PIC"`
height_pic=`identify -format %h "$PIC"`

# dimensions du sceau
width_sceau=`identify -format %w "$SCEAU"`
height_sceau=`identify -format %h "$SCEAU"`

# dimensions auxquelles réduire le sceau
stamp_w=$(( $width_pic $SCALE * 2))
stamp_h=$(( $height_pic $SCALE))


# dimensionner le sceau à la bonne taille
# PUIS mettre un bord transparent autour du sceau pour qu'il ne soit pas au bord
# PUIS coller le sceau sur l'image avec un dissolve
convert "${SCEAU}" -resize "${stamp_w}"x"${stamp_h}"\> \
-size "${stamp_w}"x"${stamp_h}" miff:- |\
convert - -matte -bordercolor none -border 20% miff:- |\
convert "$PIC" - -matte -gravity South-East \
-set "option:compose:outside-overlay" "false" \
-compose Over \
-compose dissolve -set "option:compose:args" 60 \
-composite "$OUT_IMAGE"




TODO :
  • ajouter un texte en option qui serait placé sous le sceau

  • changer la proportion en fonction de la taille de l'image ? (mais quel seuil??)
  • dimanche 5 septembre 2010

    Nautilus Main Toolbar made compact

    Since I've got my Asus eeepc 1000h, I've been looking from time to time for a way to reduce spare space on the different apps. I hence went for ubuntu-notebook-remix and it's customizations, but not everything was included. Noticeably, Nautilus, the default file browser for gnome has a "main toolbar" very space-greedy, and without simple customization ways proposed.


    I found this page pointing to some package to customize the toolbar. Look at the screenshots on this page to see the effect. If the link is down, look for the package to install (code is bellow).

    "nautilus elementary"

    Those commands were copy-pasted from the above link for re-usability :

    To install "nautilus-elementary" from it's PPA :

    sudo add-apt-repository ppa:am-monkeyd/nautilus-elementary-ppa
    sudo apt-get update && sudo apt-get upgrade
    nautilus -q #restarts nautilus



    To compile nautilus

    sudo apt-get install bzr
    sudo apt-get build-dep nautilus
    bzr branch lp:nautilus-elementary
    cd nautilus-elementary/
    ./configure --prefix=/usr && make
    sudo make install

    And restart nautilus :

    nautilus -q




    That's it. Then customize everything to suit your needs via the Tweaks tab you can find via Edit > Preferences menu in Nautilus. To customize the toolbar, simply right click on it.