Friday, March 7, 2014

How To Write Python Plug-ins for the GIMP in OS X

I am giving you the lowdown on writing plug-ins for the GIMP (2.8.1) in OS X (Mavericks).  Writing the plug-ins is not hard once you know the ins and outs (which are not well documented on the web).  I spent the better part of a day Googling for answers.  So here is what I learned:

The location of where you put the plug-ins changed when the GIMP came out with a native version for OS X.  I never did get an answer to this by Googling.  I finally just went through each subfolder of GIMP.app until I found it: /Applications/GIMP.app/Contents/Resources/lib/gimp/2.0/plug-ins

There is a very handy tool in the called Python-Fu in GIMP that lets you use Python interactively from within GIMP.  You can find it at Filters->Python-Fu->Console

You can get a list of commands at Help->Procedure Browser.  But before you use a procedure you must:


  •  import gimpfu 
  •  prepend the command with pdb(.) 
  •  change the dashes to underscores 
For example, if you want to use the procedure gimp-file-save, you need to  import gimpfu then change it to pdb.gimp_file_save(parameters)  I really want to thank Hubert and Sebastian Soyer, the authors of the blog "Bits and bobs to remember" for clueing me in on the syntax. 

When Python-Fu calls another plug-in you don't specify a run mode.  If you browse to gimp-file-save in the procedure browser, the documentation lists the parameters as:

  • run-mode - INT32 - The run mode { RUN-INTERACTIVE (0), RUN-NONINTERACTIVE (1), RUN-WITH-LAST-VALS (2) }
  • image - IMAGE - Input image
  • drawable - DRAWABLE - Drawable to save
  • filename - STRING - The name of the file to save the image in
  • raw-filename - STRING - The name as entered by the use
So you might think that you have to enter 5 parameters, right?  Nah.  You skip the run-mode parameter.  So there are only 4 parameters.  By the way,
  • you can get a list of all open images with imageArray = gimp.image_list()
  • then you can get one image by accessing it within the array  img = imageArray[#]
  • you can get the active drawable for the image with imgDrawable = pdb.gimp_image_get_active_drawable(img)
  • You can also obtain the DRAWABLE with imgDrawable = pdb.gimp_image_merge_visible_layers(img, The type of merge { EXPAND-AS-NECESSARY (0), CLIP-TO-IMAGE (1), CLIP-TO-BOTTOM-LAYER (2) })
  • You can get the filename of the image with fn = pdb.gimp_image_get_filename(img)
  • Since this is not interactive with the user, you use the same filename for both parameters
The template for writing the plug-in is well documented on the web. You can find here.  Don't forget to make your plug-in executable with
$ chmod 755 <filename.py>


I hope these hints helped you in some way.  If you have any more insights, please leave a comment.


Tuesday, March 4, 2014

Doughnuts for Dinner

My mother was 100% Irish American. But when she was a newlywed a colleague (probably German or Polish American) brought in doughnuts on Mardi Gras (Fat Tuesday).  She thought that was a great idea so she started a family tradition of making doughnuts on Fat Tuesday.  She only made doughnuts once a year and we always looked forward to them.  I have carried on that tradition with my family but with a wrinkle.

Mother's Doughnuts Recipe
 When the kids were little I was always up early anyway so I tried to make the doughnuts for breakfast.  I would end up flustered and frustrated trying to get them done before the kids went to school.  Then I remembered that Mother always made them during the day and served them up for an after school snack.  After a little bit more thought I figured that if you could have doughnuts for breakfast, why couldn't you have them for dinner? Yup, that's right. Doughnuts for dinner.  No four food groups on Mardi Gras!!

Mother always used the recipe from the Good Housekeeping Cookbook that she got as a shower gift in 1947.  When I would make them, though, they would end up heavy, undercooked and/or over-browned.  Don't get me wrong, my family and friends still loved them but I thought I could do better.

I eventually ended up making them with my own recipe that I glammed together from the original and other recipes that I found along the way.  The biggest contributor was a recipe that I found on Cook's Illustrated.

That took care of the heavy part but they were still coming out either too done or undercooked or both.  I finally broke down and bought an electric fryer that I LOVE. I use it a couple of times a week.

So here's the recipe.  ENJOY!!

Tuesday, February 25, 2014

Adding Numbers to the Quilting Grid


In the last post I introduced you to the Quilting With Inkscape series of videos on YouTube.  I am hoping that you find them useful for making your own quilting notions with Inkscape.  The finished project is available for a free download on the previous post.

The second video builds on the first one where we made a quilting grid.  This video teaches how to put the numbers on the grid where you want them to be and at the angle you want them.  Along the way it demonstrates some techniques that you can use with any objects, such as:

  • Putting text (or any object) on a path,
  • Flipping and rotating,
  • Spacing and
  • Grouping and ungrouping.
I hope these videos inspire you to make your own quilting notions.  If you make your own or if you just have an idea that you would like me to do, please share it in the comments.

If you have any questions about the video, please comment on the Quilting With Inkscape YouTube channel or on this blog. 

Quilting With Inkscape: Putting the Numbers on the Grid


Wednesday, February 12, 2014

Quilting With Inkscape


Today I published the first of a series of videos on Quilting with Inkscape.  Inkscape is a very powerful and FREE drawing program that you can download here.  With Inkscape you can design your quilts, make patterns and templates and with the help of a cutter like the Silhouette Cameo, you can even cut your fabric pieces.

The series is going to show you how easy it is to do all of those things with Inkscape so you can use the money you would have spent on those things to buy more fabric!  The first video shows you how to make a quilting grid with lines and angles that you can print onto a transparency.  By the end of the 9 minute video you will have the skills you need to start exploring Inkscape on your own.  Nevertheless, I plan on having videos on:

  •  making quilting templates and rulers, 
  •  designing quilts, 
  •  making patterns,
  •  designing pieces that you can cut fabric with the Cameo without any fusible web or interfacing, 
  • and how to make and cut paper for English Paper Piecing.  


Installing Inkscape on Windows and Linux is easy.  Mac users will need to make sure your computer is able to download apps from the web.  To enable that feature go to System Preferences-> Security and Privacy-> General and click on "Allow apps downloaded from... Anywhere".  If it is greyed out, click on the lock at the bottom left side of the page.  You will then have to put in your login password.  You can always set it back again after you have installed Inkscape.

Here is the first video, if this gets you interested, please subscribe to my channel.  You can download the finished project by clicking one of the links on the bottom of the page.




Quilting with Inkscape Making a Quilting Grid













Thursday, December 12, 2013

How To Make A Nearly Free Fruit Fly Trap

Several years ago I developed a DIY fruit fly trap that brought together several ideas that I gleaned from the web.  Sadly, I cannot give credit because I just don't remember.  Over the years I have improved and shared this trap with friends and they are all amazed at how well it works.

This is what it looks like after one day

Here's How To Make The Trap

You will need:

  • an empty jar with a wide mouth (like an old mayo jar or a mason jar)
  • a paper towel (plain white seems to attract them better)
  • some bits of fruit

To make the trap:

  1. Put a bit of fruit in the bottom of the jar. I find that grapes, pieces of banana or the squeezed out half of lemon work best.  Despite what you may have heard, red wine and vinegar are not good choices.  The idea is that it is sweetly fragrant.
  2. Twist the paper towel into a funnel with a small hole at the tip.
  3. Put the towel into the jar pointy side down.
  4. Turn the top back over the mouth of the jar.
  5. Secure with a rubber band if it doesn't want to stay put.
  6. Set it out and let it do its' job.
  7. After a day or two, put a towel over the jar to trap any flies that are on the top and carry it outside to set them free.