The Archives

  • 18.Feb.11
    Moving between encodings with emacs automated, scripts, shell | pfortuny | (0)
    I live in Spain. I work at Academia. This is a problem. My School's computers are plagued with Windows (XP!), my pupils most certainly use Windows (I bet it is 7) and I use (obviously) an MBPro with Snow Leopard. Even more, my School's servers are Linux. This gives rise to latin-1, UTF-8 collisions. While writing some text-only documents for use with MATLAB (another problem, by the way) I realized I was going to need to convert them from my Mac's UTF-8 to Windows latin-1 every time I edited them. Time for a makefile. I am not commenting this though, only the ...
  • 23.Jan.09
    Space for shell | pfortuny | (5)
    So your friend sent you a batch of tiffs to be converted into jpg's (using ImageMagick's convert command). However your friend (who is not so geeky as you) uses spaces in filenames (which is a deadly sin), like in First photo of birthday.tiff Second photo.tiff You wanted to use a shell for loop, but the obvious $ for i in `find . -name *tiff` ; do convert "$i" "${i%tiff}jpg" ; done produces garbage (try it). This is just one of the consequences of your friend's carelessness. But there is a solution. IFS (Internal Field Separator) is a shell variable controlling what character(s) delimit a 'field' in ...
  • 05.Jan.09
    Thumbnails cmd | fernape | (2)
    Easy and fast way for creating thumbnails: $ for fich in *.jpg;do convert "$fich" -resize 32x32 thumb_"$fich";done
  • 14.Dec.08
    Dealing with images cmd, shell | fernape | (0)
    It is usual to think it is not possible to deal with images if we work from the command line. However convert, part of the ImageMagick suite is able to do a great job. Example $ convert file.gif file.jpg Converts from GIF to JPG format.