Re: [Gimp-developer] [Script-fu] How to convert a path to a selection?



Here is a workaround, in Python.  This is a fragment you can enter in the GIMP Python console.  It should translate to Scheme.

image = gimp.image_list()[0]
pdb.gimp_vectors_import_from_file(image, "foo/test.svg", True, False)
# prints: (1, (3,))
# 3 is the ID of the newly imported path
activeVectors = pdb.gimp_get_active_vectors(image)
print activeVectors
# prints: <gimp.Vectors 'Imported Path#1'>
pdb.gimp_vectors_to_selection(activeVectors, 2, True, False, 0, 0)

This is sufficient if you assume that the imported vector becomes "active".

There does seem to be some confusion in the API, between ID's and objects.

Since May 2011 there is a Vectors.from_id() method in GIMP Python, which would also solve this problem, at least in Python.  Note the GIMP Python documentation doesn't document the Vectors class.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]