Linux Blog

The Gimp Tutorials

Filed under: General Linux,Linux Software — TheLinuxBlog.com at 8:00 am on Thursday, December 2, 2010

gimp tutorialsI’ll start off saying I’m graphically challenged, well more like anything visually related, I’m so bad I can’t even match my clothes properly. If you have you seen my work (check out the Free DVD Ripper Software post for a classic example) this should be obvious. I do however do all of my own stunts graphics . I remember when I used to work with a bunch of Photoshop Guru’s, they could do pretty much anything with Photoshop. They were deadly, I once saw them take a picture of our co-workers and shop it so that they were kissing other people. Apart from the system administrators these are the people I’d be least likely to pull a prank on, these guys were just pure dangerous. When I asked them how they learned to ‘shop the most common response was not from school but from the web. They pointed me to some good resources that they use to pull off certain things.

So The Gimp is everyone’s favorite open source image editing software right? Well, here are some similar websites to those mentioned above.

http://gimp-tutorials.net/

http://www.gimp.org/tutorials/

http://www.gimp-tutorials.com/

With these sites and a some time you’ll be a master like much better than me and I’ve spent hours on this stuff. You do have to admit though, my shop’n skills have got better as time has passed I some how managed to make all of these graphics Freemind Vs. Kdissert, Linux Server Monitoring, Thunderbird localmail spool and Linux Backup Utility Roundtable

http://www.thelinuxblog.com/thunderbird-localmail-spool/http://www.thelinuxblog.com/thunderbird-localmail-spool/ lo

When Photoshop Fails

Filed under: General Linux,Shell Script Sundays — TheLinuxBlog.com at 9:50 pm on Monday, January 15, 2007

I was recently assigned the task of reducing the quality of over 1000 images. My first instinct was to use photoshop’s batch functions to complete the task. After playing around with it for a little while it became apparent that you cannot save files for web with spaces in. Photoshop had failed me. My next idea was to use a bash script to loop over every file and process the image. This was sure to work. Since I have prior experience with image processing I decided to use ImageMagick to complete the task. The command to adjust the quality is:

1
convert (FILENAME) -quality 50 (FILENAME)

This command is useless on its own so using a for loop I came up with:

1
2
3
4
#!/bin/bash
for i in $(ls); do
convert $i -quality 50 $i
done

This script would have worked for me if there were no spaces in the filenames. Because there were it took each filename that had spaces and ran the command on each part of the file name. Unfortunately this was not going to work.

After googling for a while it became apparent that I was not the only person to have the problem of spaces in filenames with for loops. The solution I found was to use the find command and a while loop. Below is working script that successfully completed the task in no time:

1
2
3
4
5
#!/bin/bash
find * -iname "*" | \
while read I; do
convert "$I" -quality 50 "$I"
done

This script could be easily modified to take advantage of ImageMagick’s many other functions. For example it could be used to batch resize a folder of images to make thumbnails by changing the command to:

1
convert "$I" -resize 200 "$I"

Or it could be used to overlay text onto an image with the following command:

1
convert "$I" -gravity southeast -annotate +5+10 "thelinuxblog.com" -fill black "$I"

As shown above ImageMagick is really powerful image editing software which can easily be used with the bash shell to process thousands of images with no trouble.