Edit image in Gimp [new tool]

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
rylleman
Posts: 750
Joined: Tue Feb 15, 2005 5:22 pm
Location: sweden
Contact:

Edit image in Gimp [new tool]

Post by rylleman »

Select an image layer and run this script, the image is then opened in Gimp for editing. After you're done and has saved it in Gimp the image in A.S. gets updated to the edited version.

Installation: Place the script in your /scripts/menu/Image -foder.
With Linux it should work out of the box.
With Windows you may have to change the path to your Gimp-installation in the script if Gimp doesn't start when you run the script. Just open it up with a text-editor and change the path where I've noted.
I don't know if it works on Mac, I don't have one. If anyone running Gimp on Mac could try the script out I would be very happy.

http://www.rylanderanimation.se/moho/DR ... n_Gimp.lua

I hope you'll like this script and find it useful.
:D
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

Cool script!

I will work on the mac version when I get a chance.... uh... no... it won't work on the mac "as is" but it's simple enough to fix. Plus you should be able to make this work for ANY image editing application. I plan to change mine to Photoshop for the mac and leave it at Gimp for the PC.

-vern
chucky
Posts: 4650
Joined: Sun Jan 28, 2007 4:24 am

Post by chucky »

Thanks rylleman.
On the topic of gimp,I have noticed that with the wacom , gimp draws lines that have fairly long straight sections through the curves , quite bad when compared to , say painter.
I know gimp is a freebee, what legends the developers are for that, but I somehow suspect these steppy lines would be a priority to fix.
Is this to do with preference settings, that can be altered to improve the generation of curved lines when sketching and drawing?

Also,has anyone seen any gimp animation script that work, well?
I have a copy of mirage and I refuse to stay with TV paint and the expensive upgrades they are offering since they took over mirage.
Bitmap drawing is so fluid but not many apps do natural media well. Painter is awesome but its animation feature blows goats.
Mirage works pretty darn well I know, so I'm just curious about that.
User avatar
Víctor Paredes
Site Admin
Posts: 5646
Joined: Wed Jan 26, 2005 12:18 am
Location: Barcelona/Chile
Contact:

Post by Víctor Paredes »

Thank you, I have changed it to work with corel photopaint. It's great. really thank you.

I noticed just one problem with my scripts in general. I have added the edit in gimp script to menu, but it appears twice in the list.

I have similar problem with button tools. when I click them, they work twice. for example, vern's save bone animation works fine, but when it's all ok and saved, the window of save appears again. Same thing with every button tool in AS (another weird thing is that if I press the shortcut, it works once, just like it should be)

sorry for the off topic.
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Post by synthsin75 »

Selgin,
You must be on Windows. For some reason, any script that opens a dialog box gets activated twice when used from the tool bar. I've never had this problem from the menu though.

That tip about using them with shortcuts may be useful though. Thanks.
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Post by synthsin75 »

I tried to repurpose this script for Photoshop Elements on Windows, but no luck. It will open PSE just fine, but at first it was trying to open an image for every string in the image's path between blank spaces. Obviously no good.

So I processes the path to change all of the spaces to underscores "_". Now it says it's opening the right file name, but continues to open blank files.

I've looked and looked, but haven't found any solution for this. Perhaps I'll have to install the Gimp just for this. :roll: :?:
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Post by synthsin75 »

Okay, I solved the issues with using this for Photoshop.

Here it is, in case anyone else wants it:
http://www.mediafire.com/?zg1jymbgnox

:wink:

Great script Rylleman!
n.hurst
Posts: 45
Joined: Wed May 20, 2009 2:14 pm

Post by n.hurst »

Has anyone repurposed the GIMP script to work as a tool script (for AS Standard)? I've got the icon down - that was the easy bit:

http://www.mediafire.com/?jjhmgdzmmu4

If not, I'll mine the forum for tips on porting scripts from menus to tools, and see how it goes.

Cheers, Nick.
n.hurst
Posts: 45
Joined: Wed May 20, 2009 2:14 pm

Post by n.hurst »

Okay sussed it out. The script simply needed adding to _tool_list.txt as a button, rather than a tool. Like:

Code: Select all

button DR_Edit_in_Gimp ...
Also made one tweak to the script, wrapping the image reference in quotes to support image filenames that contained spaces:

Code: Select all

os.execute('start "GIMP" "C:\\Program Files\\GIMP\\bin\\gimp-2.6.exe" ' .. '"' .. image .. '"')
Caveats: That's on the Windows-specific line, and your GIMP program location may differ.
n.hurst
Posts: 45
Joined: Wed May 20, 2009 2:14 pm

Post by n.hurst »

Encountered another problem where my hacked tools button version of the script would run twice. Searching through the forum revealed a helpful post from synthsin75 which explained, "Also, if you're using Windows, scripts that immediately open a dialog will run twice if used as a button. Just cancel the second time it runs." ( viewtopic.php?t=12830 ). Okay. The simplest way of reworking the script was to split it into two tools:

- One button to simply open the current image layer in GIMP to "edit in place", and then...
- One button to refresh the current image layer as and when it gets saved externally.

It's a bit more accessible, and less naggy now. The script name change reflects the different functionality, since Rylleman's original is fine as it is. These scripts have only been tested on Windows, but I've kept Rylleman's OS-sensitive code, so it should work cross-platform as before.

How to install the scripts

The two tools scripts and two associated icons are zipped here (link updated for easier downloading):

http://www.mediafire.com/file/lqzjjzjzjqe

After downloading, extract the four files to your scripts/tool subfolder. Then update _tool_list.txt as shown below. I added them under the "group Layer" section, since they work with image layers:

Code: Select all

button nh_open_in_gimp ...
button nh_reload_image ...
If the two buttons don't sit nicely next to each other, you can add a button spacer to _tool_list.txt, for example:

Code: Select all

spacer
button nh_open_in_gimp ...
button nh_reload_image ...
How to use the scripts

- Use the "Open in GIMP" button to open the current image in GIMP. Edit away in GIMP, while totally free to continue working with AS. (If GIMP doesn't open, check the application path in the script on lines 59 & 61.)
- Use the "Reload image" button to simply refresh the current image layer. Doesn't matter how or where the image was edited.
Last edited by n.hurst on Tue Jun 02, 2009 2:57 pm, edited 1 time in total.
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Post by synthsin75 »

synthsin75 which explained, "Also, if you're using Windows, scripts that immediately open a dialog will run twice if used as a button. Just cancel the second time it runs."
This seems to be fixed in version 6. :wink:
Post Reply