Tips & Tutorials

Liquify in Gimp (In 5 steps!)

A place to share tips and tutorials. Resources for beginners and advanced users.

Liquify in Gimp (In 5 steps!)

Postby Rod » Tue Feb 08, 2011 6:06 pm

For those of you who want a bigger preview and somewhat better liquify tool than IWARP - this tutorial is for you.
Note: This is for Windows users only
If you can get Paint Dot Net to work in any other platform than you can probably do this also.But as far as i know PDN only works with Microsoft Frame Works, so good luck with that.
This Python Module was originaly written by Rob A to call XnView for PS filters as Gimp-2.6.11 seems to have lost it's way with PSPI plug-in.That is to say many 8bf's fail in the new version of Gimp, and XnView handles all of them nicely.

The Python Module has been edited by me to call Paint Dot Net instead.
Paint Dot Net uses user submitted plug-ins and filters just like Gimp does, and its also free source.

What you will need -
Download Paint Dot Net here with Microsoft Frame Work - http://www.getpaint.net/download.html
The Python-Fu setup for Gimp(Note: Not needed if you use the partha builds!) - http://www.gimpusers.com/tutorials/inst ... -6-windows
The Python Module (The script you can find below)

The setup is well worth it if you want to use all of PDN's filters in Gimp.

What the module does -
This python module takes the current layer or new from layer and transfers it to Paint Dot Net, where you can use any filter on it there and it will save and import back to Gimp after editing in PDN. (more explanation on that to follow)

So here is the tutorial - edited by Maffe to make it a little easier to follow.
If you have ANY questions PM me and ill help you out. :)

ENJOY!

*****************************************************************
A Python file Rob A created to call XnView, that now calls Paint Dot Net instead - Because i wanted a nice Liquify tool.

1)
First off you have to have a Windows operation system.
- Windows XP - Confirmed by Owl700
- Vista - Confirmed by Maffe811
- Windows 7 - Not confirmed


For 64-bit you can use , but it is available in both 32-bit and 64-bit!
The Partha versions also comes with python built in, so you dont' have to worry about the next step.

And you need Python installed, if you haven't !

2)
You have to have Paint . Net installed as well as Microsoft.net framework.
The paint dot net comes with that installer already so no need to hunt it down.

3)
Then you have to go to paint dot nets plug-in area and grab the Liquify filter or you can download
It has a lot of other cool filters included with liquify

4)
Install it in Paint dot net. use the auto filter installer here
http://forums.getpaint.net/index.php?ap ... ch_id=3910
Or just unzip the package of filters to the effects folder in the paint dot net directory under Program Files.
(C:\Program Files\Paint.NET\Effects)

5)
Then grab this file by righ clicking and "save link as..." Make sure its saved as a .py file
The code lays in a spoiler below if the link goes bad.
In that case:
- Open a text editor
- Paste the code
- Save as Paint.NETShell.py
- Place it in your Plug-ins folder (C:\Users\*Your username*\.gimp-2.6\plug-ins)
In Gimp you will find the plugin under Filters/Call/PaintDotNet



How to use it
Restart Gimp
Create or open an image you want to liquify
Run the script Filters/Call/Paint Dot Net
Paint dot net will open with your temp image loaded
Run the liquify tool/filter under effects/tools
Click the close button on Paint Dot net
The filter script will ask you if you want to save the changes to the temp Gimp file choose yes.
The script will then close paint dot net, export the new image layer back to Gimp and place it as a new layer on top. :)

Code in here incase link goes down:
Spoiler: show
Code: Select all
#!/usr/bin/env python

'''
Paint.NETShell.py
Call Paint.Net to allow use of Paint.Nets filters.  Windows Only.

Author:
Rob Antonishen

Version:
0.3 Fixed to work with filters that change alpha

this script is modelled after the mm extern LabCurves trace plugin
by Michael Munzert http://www.mm-log.com/lab-curves-gimp


License:

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 3 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

The GNU Public License is available at
http://www.gnu.org/copyleft/gpl.html

'''

from gimpfu import *
import shlex
import subprocess
import os, sys
import tempfile

def plugin_main(image, drawable, visible):
  pdb.gimp_image_undo_group_start(image)
 
  # Copy so the save operations doesn't affect the original
  if visible == 0:
    # Save in temporary.  Note: empty user entered file name
    temp = pdb.gimp_image_get_active_drawable(image)
  else:
    # Get the current visible
    temp = pdb.gimp_layer_new_from_visible(image, image, "Visible")
    image.add_layer(temp, 0)

  buffer = pdb.gimp_edit_named_copy(temp, "PaintDotNETShellTemp")

  #save selection if one exists
  hassel = pdb.gimp_selection_is_empty(image) == 0
  if hassel:
    savedsel = pdb.gimp_selection_save(image)
   
  tempimage = pdb.gimp_edit_named_paste_as_new(buffer)
  pdb.gimp_buffer_delete(buffer)
  if not tempimage:
    raise RuntimeError
  pdb.gimp_image_undo_disable(tempimage)

  tempdrawable = pdb.gimp_image_get_active_layer(tempimage)

  # Use temp file names from gimp, it reflects the user's choices in gimp.rc
  # change as indicated if you always want to use the same temp file name
  tempfilename = pdb.gimp_temp_name("png")
  #tempfilename = os.path.join(tempfile.gettempdir(), "Inkscapetempfile.png")
 

  # !!! Note no run-mode first parameter, and user entered filename is empty string
  pdb.gimp_progress_set_text ("Saving a copy")
  pdb.file_png_save_defaults(tempimage, tempdrawable, tempfilename, tempfilename)

  # Command line - Change to match where you installed XnView
  command = "\"C:\\Program Files\\Paint.NET\\PaintDotNet.exe\" \"" + tempfilename + "\""
  args = shlex.split(command)

  # Invoke external command
  pdb.gimp_progress_set_text ("run PaintDotNET...")
  pdb.gimp_progress_pulse()
  child = subprocess.Popen(args, shell=False)
  child.communicate()

  # put it as a new layer in the opened image
  try:
    newlayer2 = pdb.gimp_file_load_layer(tempimage, tempfilename)
  except:
    RuntimeError
  tempimage.add_layer(newlayer2,-1)
  buffer = pdb.gimp_edit_named_copy(newlayer2, "PaintDotNETShellTemp")

  if visible == 0:
    sel = pdb.gimp_edit_named_paste(drawable, buffer, 1)
  else:
    sel = pdb.gimp_edit_named_paste(temp, buffer, 1)
   
  pdb.gimp_buffer_delete(buffer)
  pdb.gimp_edit_clear(temp)   
  pdb.gimp_floating_sel_anchor(sel)

  #load up old selection
  if hassel:
    pdb.gimp_selection_load(savedsel)
    image.remove_channel(savedsel)
 
  # cleanup
  os.remove(tempfilename)  # delete the temporary file
  gimp.delete(tempimage)   # delete the temporary image

  # Note the new image is dirty in Gimp and the user will be asked to save before closing.
  pdb.gimp_image_undo_group_end(image)
  gimp.displays_flush()


register(
        "python_fu_paintdotnetshell",
        "Call PaintDotNET",
        "Call PaintDotNET",
        "Rob Antonishen",
        "Copyright 2011 Rob Antonishen",
        "2011",
        "<Image>/Filters/Call/PaintDotNET...",
        "RGB*, GRAY*",
        [ (PF_RADIO, "visible", "Layer:", 1, (("new from visible", 1),("current layer",0)))
        ],
        [],
        plugin_main,
        )

main()

I know it seems like a lot to go through just for Liquify, but you will also get all the other PDN effects with it. ;)
Members don't see the above ad. Register now - it's free!
Image
User avatar
Rod
Global Moderator
 
Posts: 1740
Joined: Mon Apr 19, 2010 7:58 pm

Re: Liquify in Gimp

Postby Maffe811 » Tue Feb 08, 2011 7:00 pm

Okay, ive got this to work on Vista (32bit) and it works great! ;D
Now, i think the reason it doesnt work on 64bit is a problem in the script... or that i use 32 bit gimp and 32 bit python... but i didnt think it would matter wich version i used...

But... i dont know!
ive done everything i did on the Vista machine and that works great, but when i click the script in gimp it doesnt work on the 64bit machine...
when i think about it... it could be win 7 :P

Is XP confirmed?
Is there anyone here that can test this on Win 7 32bit ?

But should we link the direct links to the Python and Pygtk ?
Got möp?
Image
SOTW #1 ^
"Photoshop!? You don't need no stinkin' Photoshop" - We'll show you the power of the Gimp!!!
---
Honest CnC always beats crap CnC
Baum wrote:I think it doesnt has to be mentioned that self-voters have a small p....hotograph :D
User avatar
Maffe811
Global Moderator
 
Posts: 6810
Joined: Thu Jul 02, 2009 1:00 pm
Location: Norway/Norge/Norwegen

Re: Liquify in Gimp

Postby Owl700 » Sun Mar 27, 2011 12:03 am

I am just a beginner, and managed to get everything working in XP. ;D

I downloaded and followed the directions for installing Python from here:
http://www.gimpusers.com/tutorials/inst ... -6-windows
I installed Paint and followed your tutorial.
Everything works like a charm!
Thanx for the help
Owl700
Newbie
 
Posts: 1
Joined: Thu Jan 27, 2011 1:24 pm

Re: Liquify in Gimp

Postby Willy » Sun Mar 27, 2011 12:05 am

Why exactly is this using MyPaint.net? Is there something I missed during my short time using it?
Image By Maffefefe
Image

Image
Made by the AWESOME Captain of Sexeh, Maffe
Maffe811 wrote:Im sorry, but whenever some one comes in and posts 3-5 posts without introducing themself and sorta just jump into the topics i imidiatly(?) think they are a bot.

Watch yourself *stares*
User avatar
Willy
Hero Member
 
Posts: 746
Joined: Sat Mar 26, 2011 11:18 pm
Location: Michigan

Re: Liquify in Gimp

Postby Maffe811 » Sun Mar 27, 2011 11:36 am

Photoshop has liquify.
Gimp has iWarp.
Gimp's iWarp window is tiiiiiiiiiiiiiiiiiiiiiiiiinyyyyyyyyyyyyy!!!!!
Now gimp uses a paint.net liquify addon wich is full screen like photoshop's!

Its all just to get bigger editing area... Cause gimp's editing area...
Its to small to do any good... Thats what she said ;D

Gimp(Tiny window):
Image

PS(full screen):
Image
Got möp?
Image
SOTW #1 ^
"Photoshop!? You don't need no stinkin' Photoshop" - We'll show you the power of the Gimp!!!
---
Honest CnC always beats crap CnC
Baum wrote:I think it doesnt has to be mentioned that self-voters have a small p....hotograph :D
User avatar
Maffe811
Global Moderator
 
Posts: 6810
Joined: Thu Jul 02, 2009 1:00 pm
Location: Norway/Norge/Norwegen

Re: Liquify in Gimp

Postby Willy » Sun Mar 27, 2011 12:53 pm

Sup with her face, and thanks now I understand
Image By Maffefefe
Image

Image
Made by the AWESOME Captain of Sexeh, Maffe
Maffe811 wrote:Im sorry, but whenever some one comes in and posts 3-5 posts without introducing themself and sorta just jump into the topics i imidiatly(?) think they are a bot.

Watch yourself *stares*
User avatar
Willy
Hero Member
 
Posts: 746
Joined: Sat Mar 26, 2011 11:18 pm
Location: Michigan

Re: Liquify in Gimp

Postby Maffe811 » Sun Mar 27, 2011 1:37 pm

Idk, found the image on google :P
Got möp?
Image
SOTW #1 ^
"Photoshop!? You don't need no stinkin' Photoshop" - We'll show you the power of the Gimp!!!
---
Honest CnC always beats crap CnC
Baum wrote:I think it doesnt has to be mentioned that self-voters have a small p....hotograph :D
User avatar
Maffe811
Global Moderator
 
Posts: 6810
Joined: Thu Jul 02, 2009 1:00 pm
Location: Norway/Norge/Norwegen

Re: Liquify in Gimp

Postby Willy » Sun Mar 27, 2011 1:38 pm

She has a very large eye... Maybe it is... omg Rebbeca Black?
Image By Maffefefe
Image

Image
Made by the AWESOME Captain of Sexeh, Maffe
Maffe811 wrote:Im sorry, but whenever some one comes in and posts 3-5 posts without introducing themself and sorta just jump into the topics i imidiatly(?) think they are a bot.

Watch yourself *stares*
User avatar
Willy
Hero Member
 
Posts: 746
Joined: Sat Mar 26, 2011 11:18 pm
Location: Michigan

Re: Liquify in Gimp

Postby Maffe811 » Sun Mar 27, 2011 1:51 pm

yeah, that was liqufy can do... :P
Got möp?
Image
SOTW #1 ^
"Photoshop!? You don't need no stinkin' Photoshop" - We'll show you the power of the Gimp!!!
---
Honest CnC always beats crap CnC
Baum wrote:I think it doesnt has to be mentioned that self-voters have a small p....hotograph :D
User avatar
Maffe811
Global Moderator
 
Posts: 6810
Joined: Thu Jul 02, 2009 1:00 pm
Location: Norway/Norge/Norwegen

Re: Liquify in Gimp

Postby Rod » Fri Apr 08, 2011 3:28 am

Glad to hear you all got it working okay. :)
The nice thing about this script is you can add other programs to the python script and Gimp will run any of them.
My list so far

XNView
ASCII Gen
Anamorphe Me
Photo Shop CS5
Imagelys
MS Paint
Deep Paint
Inkscape
PaintDOTNet
MyPaint
Photo Filter Factory,
Photo Pos Pro
Java mosaic
Java Image Editor
Vector Magic
Photo Clinic

So as you can see Gimp was given quite a bit of power with this script.
Rob A is a genius. :)
Image
User avatar
Rod
Global Moderator
 
Posts: 1740
Joined: Mon Apr 19, 2010 7:58 pm

Re: Liquify in Gimp

Postby Maffe811 » Fri Apr 08, 2011 9:34 am

Thats awsome!!! :P
Got möp?
Image
SOTW #1 ^
"Photoshop!? You don't need no stinkin' Photoshop" - We'll show you the power of the Gimp!!!
---
Honest CnC always beats crap CnC
Baum wrote:I think it doesnt has to be mentioned that self-voters have a small p....hotograph :D
User avatar
Maffe811
Global Moderator
 
Posts: 6810
Joined: Thu Jul 02, 2009 1:00 pm
Location: Norway/Norge/Norwegen

Re: Liquify in Gimp

Postby Rod » Mon Aug 15, 2011 7:19 pm

Has anyone gotten it to work in 64 bit yet?
It should work if the Paint Dot Net and Gimp are both 64 bit.
I wonder if i could get someone at GimpChat.com with Parthas version of 2.7.3 64 bit Gimp to test it? :)
As i am pretty darn sure Gimp-2.6.11 does not come with a 64 bit install.
Image
User avatar
Rod
Global Moderator
 
Posts: 1740
Joined: Mon Apr 19, 2010 7:58 pm

Re: Liquify in Gimp

Postby Maffe811 » Mon Aug 15, 2011 10:35 pm

I don't remeber... :P
Il download and test even tough im supposed to be in bed! :P

Edit:
It finished up extracting the files, so i poped the script in the corect folder and started partha-gimp.
It sucessfully called paint.net after i tweaked the path in the script(not sure if that is needed though).
I forgot the paint.net plug-ins but they aren't the important part.

I edited the first post and added that it worked.
Please check my spelling as it is 1:15 am :P *YAWN*
5 hours and 45 minutes with sleep if i go to bed now :P
Got möp?
Image
SOTW #1 ^
"Photoshop!? You don't need no stinkin' Photoshop" - We'll show you the power of the Gimp!!!
---
Honest CnC always beats crap CnC
Baum wrote:I think it doesnt has to be mentioned that self-voters have a small p....hotograph :D
User avatar
Maffe811
Global Moderator
 
Posts: 6810
Joined: Thu Jul 02, 2009 1:00 pm
Location: Norway/Norge/Norwegen


Return to Tips & Tutorials

Who is online

Users browsing this forum: No registered users and 2 guests