Register now and start sharing your code snippets.

ImageMagick and OpenEXR

Shell Script (Bash) posted 24 days ago by marko

I could not get OpenEXR delegate to work in ImageMagick. There was no reason for it in config.log. It just silently refused to get configured. I debugged the configure script and found out that PKG _CONFIG was unset. So this fixed it. The—enable-hdri should be optional.

   1  ./configure PKG_CONFIG=/usr/bin/pkg-config --prefix=/usr/local/stow/imagemagick --enable-hdri

Tagged openexr, imagemagick

Installing ImageMagick from sources and using xstow to handle the installation.

Shell Script (Bash) posted 28 days ago by marko

I really hate installing software outside of the package manager, because that is not the way of a stable system. Xstow helps the agony those times that sourceball installations are necessary (e.g for new features). Here’s how to install imagemagick with xstow. If you haven’t installed xstow yet, then follow the relevant instructions in this snippet

   1  sudo apt-get install libmagick9-dev # needed for sane image support
   2  cd /tmp
   3  wget ftp://ftp.sunet.se/pub/multimedia/graphics/ImageMagick/ImageMagick-6.4.2-7.tar.bz2
   4  tar xjvf ImageMagick-6.4.2-7.tar.bz2
   5  sudo mv ImageMagick-6.4.2 /usr/src
   6  cd /usr/src
   7  sudo ln -s ImageMagick-6.4.2 imagemagick
   8  cd imagemagick
   9  ./configure --prefix=/usr/local/stow/imagemagick
  10  make
  11  sudo make install
  12  cd /usr/local/stow
  13  sudo xstow imagemagick

Tagged xstow, imagemagick

Bulk resizing images with Imagemagick.

Shell Script (Bash) posted 2 months ago by marko

Quick and dirty, but handy one-liner that resizes all *.jpg files in the current directory.

   1  for image in *.jpg; do convert $image -resize 800x600 800x600-$image; done

Tagged imagemagick, bulk resize

Installing ImageMagick, mini-magick and rmagick on Mac OS X Leopard

Ruby posted 5 months ago by christian

I had no success installing ImageMagick and mini-magick with the instructions I found on this page but after some googling I found this blog post, which had the magic commands that worked for me:

   1  sudo port install tiff -macosx  #disables the linkage with Apple's open gl
   2  sudo port install ImageMagick
   3  
   4  sudo gem install rmagick
   5  sudo gem install mini_magick

To test mini-magick, open an irb console and paste in the following code:

   1  require 'rubygems'
   2  require 'mini_magick'
   3  
   4  path = "public/images/0000/0003/logo.jpg"
   5  image = MiniMagick::Image.new(path)
   6  
   7  #print width and height
   8  puts image[:width]
   9  puts image[:height]

Tagged imagemagick, attachment_fu, rails, ruby, mac, osx, leopard, mini-magick, rmagick

Screenshot in wmii

Shell Script (Bash) posted about 1 year ago by marko

Method 1

A simple script to create a screenshot in wmii. It probably works in other window managers too. I call it ‘scrot’. Put it in the path and run it as you’d run any program in wmii. The “import” program comes with imagemagick.

   1  #!/bin/bash
   2  import -window root /tmp/screenshot.png

Method 2

If you want timestamped screenshots then

   1  apt-get install scrot
   2  mkdir -p ~/screenshots

And create a script with the following content for making the screenshot.

   1  #!/bin/bash
   2  scrot '%Y-%m-%d-%H-%M-%S_$wx$h_scrot.png' -e 'mv $f ~/screenshots'

Tagged wmii, screenshot, linux, imagemagick