Re: [Gimp-user] How to get the positions(x, y) (width, depth) of selected rectangle or selected ellipse



Dear Ofnuts. Thanks!  ;) There was a good way!

Is it OK?

with open(file_name, 'w') as f:
  writer = csv.writer(f)
  writer.writerow([x1, y1, x2, y2])


2020年2月14日(金) 16:34 Ofnuts <ofnuts gmx com>:

Uh? You can write to a file from the script, using the regular I/O
functions.

For more structured data you can also use the built-in CSV module to
write CSV files, and it is also possible to add excel support to the
python runtime.

On 2/14/20 8:19 AM, ShiroYuki Mot via gimp-user-list wrote:
On Python console, this is what you want.
non_empty, x1, y1, x2, y2 = pdb.gimp_selection_bounds(image)
See, 'gimp-selection-bounds' at Procedure Browser.
But, handning values to external App is not so easy.
If you add external library 'pyperclip' you can write to clipboard.
But it is one value only... Yes, maybe, not suit for you.
One solution is that create text layer about that.
Then you can copy manually.


_______________________________________________
gimp-user-list mailing list
List address:    gimp-user-list gnome org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list



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