Anciennes révisionsLiens de retourExporter en PDFHaut de page Share via Share via... Twitter LinkedIn Facebook Pinterest Telegram WhatsApp Yammer RedditDerniers changementsSend via e-MailImprimerPermalien × ImageMagick pics kw: imagik, imagick voir aussi: imgp software suite to create, edit, and compose bitmap images. It can read, convert and write images in a variety of formats (over 100) including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript, SVG, and TIFF. Use ImageMagick to translate, flip, mirror, rotate, scale, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves. http://imagemagick.org/ Examples of ImageMagick Usage http://imagemagick.org/script/command-line-processing.php Command-line Tools: convert examples convert -background lightblue -fill blue -font Candice -pointsize 72 label:Anthony label.gif convert -size 320x85 xc:transparent -font Bookman-DemiItalic -pointsize 72 -draw "text 25,60 'Magick'" \ -channel RGBA -gaussian 0x6 -fill darkred -stroke magenta -draw "text 20,55 'Magick'" fuzzy-magick.png Re: batch resize in a folder? Postby fmw42 » 2009-09-04T19:08:55+00:00 cd to the directory where your images are located (temp) after creating a new directory to hold the changed files (say, temp2) mogrify -path fullpathto/temp2 -resize 60×60% -quality 60 -format jpg *.png this will take all png files in your current directory (temp), resize to 60% (of largest dimension and keep aspect ratio), set jpg quality to 60 and convert to jpg. see http://www.imagemagick.org/Usage/basics/#mogrify Ajouter du texte à des images Vous avez un lot d'images sur lequel vous souhaitez ajouter du texte (p. ex. la source)? quelques exemples tirés de http://ubuntu.5.n6.nabble.com/Texte-sur-photos-td787025.html Ajouter un bandeau de texte bleu sur fond blanc au dessous d'image.jpg: convert image.jpg -background white -font Helvetica -fill blue -pointsize 72 label:"phrase de test" -gravity Center -append image_avec_texte.jpg Ajouter un bandeau de texte bleu sur fond blanc au dessus d'image.jpg: convert image.jpg -background white -font Helvetica -fill blue -pointsize 72 label:"phrase de test" +swap -gravity Center -append image_avec_texte.jpg Ajouter du texte blanc surligner en noir sur image.txt: convert image.jpg -font Helvetica -pointsize 48 -gravity south -stroke '#000C' -strokewidth 2 -annotate 0 "phrase de test" -stroke none -fill white -annotate 0 "phrase de test" image_avec_texte.jpg -pointsize permet de gérer la taille de l'image -gravity permet de gérer l'emplacement du texte sur l'image (south, north, east, west ....) -font permet de sélectionner la police utilisée ... utiliser la commande "identify -list font" pour connaître la liste des polices accessibles par convert Après un peu de bash et le tour est joué (voir sur la source http://ubuntu.5.n6.nabble.com/Texte-sur-photos-td787025.html) Pour fabriquer rapidement des boutons boutons_creation.sh Pour changer des couleurs http://www.imagemagick.org/Usage/color/ info_convert_Generate a test image for IM examples scripts_convert_color.sh find_images_and_change_colors Simple identify -verbose mw_box_tl.png Histogram: chercher dans Histogram la plus grande valeur, donne une idée de la couleur la plus répandue 671: (161, 15, 21) #A10F15 rgb(161,15,21) puis convert mw_box_tl.png -fuzz 15% -fill "rgb(207,0,99)" -opaque "rgb(161,15,21)" output.jpg Scanner / appareil photo prendre les photos avec un pied puis ls -1 *.jpg | while read i do #conversion couleur noir-blanc convert $i -colorspace Gray $i test.jpg #on deplace le coin haut gauche origine a -400 -300 convert -crop 3000x2300+400x300 test.jpg test1.jpg #on deplace le coin bas droite convert -crop 3000x2300-600-300 test1.jpg nb/$i done $ convert rose.jpg -resize 50% rose.png resize before ftp (on work) http://www.imagemagick.org/Usage/resize/ http://www.imagemagick.org/Usage/basics/#mogrify http://www.imagemagick.org/script/mogrify.php mogrify -resize 800 $i #!/usr/bin/bash #/media/radeff/8cca64c2-83a1-4cf9-8f8f-3ba2b906dd42/photos/2015/20150723fabsamsung 417M -> 47M!!! find . -size +300k | while read i do echo "mogrify -resize 1024 $i" mogrify -resize 800 $i done http://www.howtogeek.com/109369/how-to-quickly-resize-convert-modify-images-from-the-linux-terminal/ http://unix.stackexchange.com/questions/38943/use-mogrify-to-resize-large-files-while-ignoring-small-ones http://www.smashingmagazine.com/2015/06/efficient-image-resizing-with-imagemagick/ Most command-line shells allow you to setup aliases and functions for complicated commands. If you use a bash shell, you can add a function to your .bash_aliases (or .bashrc) file that acts as an alias for my recommended command: smartresize() { mogrify -path $3 -filter Triangle -define filter:support=2 -thumbnail $2 -unsharp 0.25x0.08+8.3+0.045 -dither None -posterize 136 -quality 82 -define jpeg:fancy-upsampling=off -define png:compression-filter=5 -define png:compression-level=9 -define png:compression-strategy=1 -define png:exclude-chunk=all -interlace none -colorspace sRGB $1 } Then, you can call it like this: smartresize inputfile.png 300 outputdir/ info/imagemagick.txt Dernière modification : 2020/03/22 16:25de radeff S'identifier