Edit image in Gimp [new tool]

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

Moderators: Fahim, Distinct Sun, Víctor Paredes, erey, Belgarath, slowtiger

Edit image in Gimp [new tool]

Postby rylleman » Thu Dec 11, 2008 8:19 pm

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_Edit_in_Gimp.lua

I hope you'll like this script and find it useful.
:D
User avatar
rylleman
 
Posts: 746
Joined: Tue Feb 15, 2005 5:22 pm
Location: sweden

Postby heyvern » Thu Dec 11, 2008 8:47 pm

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
User avatar
heyvern
 
Posts: 6964
Joined: Fri Sep 02, 2005 4:49 am

Postby chucky » Thu Dec 18, 2008 2:01 pm

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.
Sequential offender.
my latest animations
User avatar
chucky
 
Posts: 3455
Joined: Sun Jan 28, 2007 4:24 am
Location: Van Diemen's Land

Postby Víctor Paredes » Thu Dec 18, 2008 4:51 pm

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
Víctor Paredes
 
Posts: 4770
Joined: Wed Jan 26, 2005 12:18 am
Location: Ireland

Postby synthsin75 » Thu Dec 18, 2008 11:32 pm

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: 6045
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma

Postby synthsin75 » Fri Jan 02, 2009 7:48 am

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: 6045
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma

Postby synthsin75 » Sun Jan 04, 2009 7:44 am

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!
User avatar
synthsin75
 
Posts: 6045
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma

Postby n.hurst » Sat May 30, 2009 3:13 pm

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

Postby n.hurst » Sat May 30, 2009 3:30 pm

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

Postby n.hurst » Sat May 30, 2009 5:45 pm

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." ( http://www.lostmarble.com/forum/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.
n.hurst
 
Posts: 45
Joined: Wed May 20, 2009 2:14 pm

Postby synthsin75 » Sat May 30, 2009 5:55 pm

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:
User avatar
synthsin75
 
Posts: 6045
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma


Return to Scripting

Who is online

Users browsing this forum: No registered users and 1 guest