Fix: “Edit with GIMP” context menu in Windows 7 x64

I can’t remember when it happened but at some point, I lost the “Edit with GIMP” context menu for image files after I started using Windows 7 about a year ago. I just installed the GIMP 2.6.10 x64 version and I noticed that the issue wasn’t fixed. (I had a further problem because the Open With shell magic was broken because the 2.6.10 installer uses a different directory than the 2.6.9 x64 installer did.)

With my context menus thoroughly busted for images, I had a look in the registry. For every sort of image file, there were shell verbs configured. For example, here’s jpeg:

jpegfile\shell\Edit with GIMP]
@="Edit with GIMP"

[HKEY_CLASSES_ROOT\jpegfile\shell\Edit with GIMP\command]
@="\"C:\\Program Files\\GIMP 2\\bin\\gimp-2.6.exe\" \"%1\""

This all looks fine. It’s a custom shell verb called “Edit with GIMP” with the menu label “Edit with GIMP” that invokes the gimp-2.6.1.exe executable, passing the argument of the file name.

Except it doesn’t do anything in Windows 7.

I channeled Mark Russinovich and fired up Sysinternals ProcMon and had a look at what the explorer.exe process is accessing in the registry when I right-click on a jpeg.

procmon

It turns out that Explorer isn’t looking at jpegfile or pngfile or giffile et al. It is looking at “image files" as a class via HKCR\SystemFileAssociations\image. Therefore, the solution is to add a custom shell verb there:

[HKEY_CLASSES_ROOT\SystemFileAssociations\image\shell\Edit with GIMP]
@="Edit with GIMP"

[HKEY_CLASSES_ROOT\SystemFileAssociations\image\shell\Edit with GIMP\command]
@="\"C:\\Program Files\\GIMP 2\\bin\\gimp-2.6.exe\" \"%1\""

And success.

image-context-menu