Shallow Thoughts : : gimp

Akkana's Musings on Open Source, Science, and Nature.

Thu, 29 Jul 2010

How to save on modeling fees

[Terrible's ad] At the Terrible's Sands Regency in Reno, Dave noticed this ad on the table in the room. "Wait -- isn't that the same guy, twice?"

Sure enough -- not just the same person, but the same photo, with different hair and neck pixeled in.

I guess Photoshop/GIMP artists are cheaper than photo models these days.

We spotted the same model in other ads around the hotel, sometimes masquerading as other races as well.

Tags: , ,
[ 16:28 Jul 29, 2010    More gimp | permalink to this entry ]

Sat, 10 Jul 2010

Interactive arrow design in GIMP

How many times have you wanted an easy way of making arrows in GIMP?

I need arrows all the time, for screenshots and diagrams. And there really isn't any easy way to do that in GIMP. There's a script-fu for making arrows in the Plug-in registry, but it's fiddly and always takes quite a few iterations to get it right. More often, I use a collection of arrow brushes I downloaded from somewhere -- I can't remember exactly where I got my collection, but there are lots of options if you google gimp arrow brushes -- then use the free rotate tool to rotate the arrow in the right direction.

[GIMP Arrow Designer] The topic of arrows came up again on #gimp yesterday, and Alexia Death mentioned her script-fu in GIMP Fx Foundary that "abuses the selection" to make shapes, like stars and polygons. She suggested that it would be easy to make arrows the same way, using the current selection as a guide to where the arrow should go.

And that got me thinking about Joao Bueno's neat Python plug-in demo that watches the size of the selection and updates a dialog every time the selection changes. Why not write an interactive Python script that monitors the selection and lets you change the arrow by changing the size of the selection, while fine-tuning the shape and size of the arrowhead interactively via a dialog?

Of course I had to write it. And it works great! I wish I'd written this five years ago.

This will also make a great demo for my OSCON 2010 talk on Writing GIMP Scripts and Plug-ins, Thursday July 22. I wish I'd had it for Libre Graphics Meeting last month.

It's here: GIMP Arrow Designer.

Tags: , , ,
[ 10:25 Jul 10, 2010    More gimp | permalink to this entry ]

Thu, 10 Jun 2010

GIMP 3-D, 3 Ways

I'm back from Europe (and still recovering from a cold picked up right after I got back). And today I have a GIMP quickie on Linux Planet discussing three ways to add three-dimensional looks to otherwise flat images in GIMP:

GIMP 3-D, 3 Ways.

Tags: ,
[ 09:36 Jun 10, 2010    More gimp | permalink to this entry ]

Sun, 14 Mar 2010

Finally -- Tapered lines in GIMP! How to make them (in 2.7).

[grass brush example] So many times I've wanted a way to make tapered lines in GIMP. It doesn't come up that often, but when it does, it's frustrating that it's so difficult.

For instance, when I was working on the animated brush section of Beginning GIMP, I wanted to make a brush that looked like grass, because that's something I've found quite difficult to do by hand in GIMP. But to make each blade of grass, I ended up drawing a green line of fixed width, zoom way in, then using the lasso selection tool to select and clear the edges of the end of each stroke. What a pain!

[tapered lines in GIMP] Imagine my excitement when I saw GIMP developer Alexia Death talking about how she'd added taper to GIMP's Paint Dynamics in the development version of GIMP. I had to try it.

But I needed some help figuring out how to do it, and I know I'll forget; so I wrote up a tutorial, both for myself and to help anyone else who needs tapered lines.

Alas, this feature is brand new and only works in recent development builds. But if you aren't that current with GIMP, it's something to look forward to. I'll keep this tutorial updated in case methods change.

GIMP Tutorial: Tapered lines

Tags: ,
[ 19:26 Mar 14, 2010    More gimp | permalink to this entry ]

Wed, 23 Dec 2009

Fixing holiday photos with GIMP

Third in my GIMP-for-the-holidays series on Linux Planet: Fixing holiday photos with GIMP

Happy holidays, everybody ... and happy holiday photos!

Tags: , ,
[ 18:44 Dec 23, 2009    More gimp | permalink to this entry ]

Thu, 17 Dec 2009

Print your custom-made greeting cards

[Sample greeting card] A followup to last week's article on making custom greeting cards with GIMP, today's Linux Planet tutorial discusses how to get those cards printed -- even if you don't own a decent color printer.

On Linux Planet: Printing Holiday Cards Even if you Don't Have a Printer.

Tags: , ,
[ 18:50 Dec 17, 2009    More gimp | permalink to this entry ]

Thu, 10 Dec 2009

GIMP Tutorial: Make your own holiday greeting cards

[Sample greeting card] Today's Linux Planet tutorial is a simple walkthrough showing you how to make custom greeting cards in GIMP:

Make Your Own Holiday Cards with GIMP.

Have fun!

Part 2, next week, will offer tips on printing, whether on a home inkjet or using other services.

Tags: ,
[ 14:19 Dec 10, 2009    More gimp | permalink to this entry ]

Tue, 15 Sep 2009

GTK dialogs in GIMP (and updated wallpaper script)

[Grosvenor Arch] I've been getting tired of my various desktop backgrounds, and realized that I had a lot of trip photos, from fabulous places like Grosvenor Arch (at right), that I'd never added to my background collection.

There's nothing like lots of repetitions of the same task to bring out the shortcomings of a script, and the wallpaper script I threw together earlier this year was no exception. I found myself frequently irritated by not having enough information about what the script was doing or being able to change the filename. Then I could have backgrounds named grosvenor.jpg rather than img2691.jpg.

Alas, I can't use the normal GIMP Save-as dialog, since GIMP doesn't make that dialog available to plug-ins. (That's a deliberate choice, though I've never been clear on the reason behind it.) If I wanted to give that control to the user, I'd have to make my own dialogs.

It's no problem to make a GTK dialog from Python. Just create a gtk.Dialog, add a gtk.Entry to it, call dialog.run(), then check the return value and get the entry's text to see if it changed. No problem, right?

Ha! If you think that, you don't work with computers. The dialog popped up fine, it read the text entry fine ... but it wouldn't go away afterward. So after the user clicked OK, the plug-in tried to save and GIMP popped up the JPEG save dialog (the one that has a quality slider and other controls, but no indication of filename) under my text entry dialog, which remained there.

All attempts at calling dialog.hide() and dialog.destroy() and similar mathods were of no avail. A helpful person on #pygtk worked with me but ended up as baffled as I was. What was up?

The code seemed so simple -- something like this:

    response = dialog.run()
    if response == gtk.RESPONSE_OK :
        pathname = pathentry.get_text()
        dialog.hide()
        dialog.destroy()
        pdb.gimp_file_save(newimg, newimg.active_layer, pathname, pathname,
                           run_mode=0)

In the end, GIMP guru Sven pointed me to the answer. The problem was that my dialog wasn't part of the GTK main loop. In retrospect, this makes sense: the plug-in is an entirely different process, so I shouldn't be surprised that it would have its own main loop. So when I hide() and destroy(), those events don't happen right away because there's no loop in the plug-in process that would see them.

The plug-in passes control back to GIMP to do the gimp_file_save(). GIMP's main loop doesn't have access to the hide and destroy signals I just sent. So the gimp_file_save runs, popping up its own dialog (under mine, because the JPEG save dialog is transient to the original image window while my python dialog isn't). That finishes, returns control to the plug-in, the plug-in exits and at that point GTK cleans up and finally destroys the dialog.

The solution is to loop over GTK events in the plug-in before calling gimp_file_save, like this:

    response = dialog.run()
    if response == gtk.RESPONSE_OK :
        pathname = pathentry.get_text()
        dialog.hide()
        dialog.destroy()
        while gtk.events_pending() :
            gtk.main_iteration()
        pdb.gimp_file_save(newimg, newimg.active_layer, pathname, pathname,
                           run_mode=0)

That loop gives the Python process a chance to clean up the dialog before passing control to GIMP and its main loop. GTK in the subprocess is happy, the user is happy, and I'm happy because now I have a much more efficient way of making lots of desktop backgrounds for lots of different machines.

The updated script, along with a lot more information on how to use it and how to set up tool presets for it.

Tags: ,
[ 22:21 Sep 15, 2009    More gimp | permalink to this entry ]