2007-01-27 : Différence entre versions

De Asso Val Libre
Aller à : navigation, rechercher
(Conversion par lot de format graphiques)
Ligne 19 : Ligne 19 :
 
  #!/usr/bin/make -f
 
  #!/usr/bin/make -f
 
   
 
   
  JPG=$(wildcard *.jpg)
+
  BMP=$(wildcard *.bmp)
 
   
 
   
  all: $(JPG:.jpg=.bmp)  
+
  all: $(BMP:.bmp=.jpg)  
 
    
 
    
 
  .SUFFIXES: .jpg .bmp
 
  .SUFFIXES: .jpg .bmp
 
   
 
   
  .jpg.bmp:
+
  .bmp.jpg:
 
  convert  $<  $@
 
  convert  $<  $@
  

Version du 27 janvier 2007 à 21:59

À voir

  • Machine Aquario
  • Site aquario / album photo / diaporama

Conversion par lot de format graphiques

Depuis le temps que j'y pensais, voici un exemple de script commenté :

L'exempe ci-dessous converti les fichiers .jpg en .bmp en utilisant convert. C'est un script pour l'utilitaire make

Mettre le texte suivant dans un fichier dénommé Makefile dans le répertoire de travail. Ensuite au même endroit, simplement taper la commande

make


#!/usr/bin/make -f

BMP=$(wildcard *.bmp)

all: $(BMP:.bmp=.jpg) 
 
.SUFFIXES: .jpg .bmp

.bmp.jpg:
	convert  $<  $@


Attention, devant la commande convert l'espace vide est une tabulation (impératif)

Pour info