Thanks David.  I stumbled onto that solution just before I checked my email

This does the trick of creating the file to go to PNG:

    img2 = pdb.gimp_edit_paste_as_new()

It does work nice and doesn't seem to take too long.

So, my script does almost everything that I want.  One last annoyance is
that I can't seem to get the window title to change from Untitled-N.0 after
the XCF save to the XCF filename.  Neither of these seem to set the window

pdb.gimp_xcf_save(1, img, drawable, xcf_path, xcf_path)
pdb.gimp_file_save(img, drawable, xcf_path, xcf_path)

It makes me a little nervous to close windows that don't have the filenames
in the title and are not marked clean (no *).  I can do this at the end of
the script


but the docs seem to say I shouldn't and that still doesn't set the window

How should I save an XCF from a Python script (I assume either of the pdb
save methods above) and how do I set the window title?  Should the image
automatically be set as clean?



On Fri, May 29, 2009 at 12:46 AM, David Gowers <> wrote:

> Hello Ryan,
> On Fri, May 29, 2009 at 1:48 PM, Ryan Krauss <> wrote:
> > I have a Python Gimp question.  I don't know if it belongs on the user or
> > developer list, but my feeling is that the people with the knowledge are
> > more likely to read this list.  Let me know if this is the wrong list to
> > post to.
> >
> > I have written a script to create PNG and XCF versions of an image I want
> to
> > save.  I have a certain layer whose visibility I want to turn off before
> I
> > save the PNG but I also want the XCF to give me more editting power if I
> > want to alter the image later.  I have this working fairly well, but the
> > problem is that when my script finishes, I am looking at the flattened
> > version of the image.  At that point, I would need to close the PNG and
> > re-open the XCF if I want to edit the file.  This is less than ideal.  I
> > think it could be solved by simply doing one undo step after saving the
> > (since flattening was the last thing I did), but I don't see in the
> > procedural database a way to undo from a script.  Is there a way to save
> a
> > flattened PNG and then save an unflattened XCF of the same image and
> leave
> > the XCF open?
> Duplicate the image and do your flattening on the copy. It's more
> efficient than you might think -- the main time involved in
> duplicating a moderate sized image seems to be actually in setting up
> its GUI window rather
Gimp-developer mailing list

Reply via email to