Re: [Gimp-user] How to get the positions(x, y) (width, depth) of selected rectangle or selected ellipse
- From: ShiroYuki Mot <shiroyuki mot mail gmail com>
- To: tamasakai <forums gimpusers com>
- Cc: gimp-user-list gnome org
- Subject: Re: [Gimp-user] How to get the positions(x, y) (width, depth) of selected rectangle or selected ellipse
- Date: Mon, 17 Feb 2020 11:22:54 +0900
If you can read the Japanese, please see the next.
It is my blog post. :)
https://shiroyuki-mot-says.blogspot.com/2020/02/gimp-script-py-create-csv-file.html
2020年2月17日(月) 10:31 ShiroYuki Mot <shiroyuki mot mail gmail com>:
Please learn the basic scripting of GIMP Python.
See as follows.
https://www.gimp.org/docs/python/index.html
If opened image by GIMP is one only at first and it has one layer and a
selection is existing.
Example on Windows OS - Python Console.
image = gimp._id2image(1)
# 1 is shown at GIMP Title-Bar as '[Name] (Status)- 1.0 (RGB ...'
image
import csv
file_name = "c:\\Users\\YourName\\Documents\\Temp\\SampleXcfCsv.txt"
file_name
non_empty, x1, y1, x2, y2 = pdb.gimp_selection_bounds(image)
x1
y1
x2
y2
with open(file_name, 'w') as f:
writer = csv.writer(f)
writer.writerow([x1, y1, x2, y2])
2020年2月17日(月) 9:52 tamasakai <forums gimpusers com>:
Dear Ofnuts. Thanks! ;) There was a good way!
Is it OK?
2020年2月14日(金) 16:34 Ofnuts <ofnuts gmx com>:
Thank you for all members replied to my questions.
I am jast a biginner of GIMP.
So please tell me step by step with patience.
Then, I wrote a script, made a image named "sample.xcf" and made a
rectangle
selection on it.
The script on Python Consol made errors.
What should I do next?
--------------------------------
# How to get the positions(x, y) (width, depth) of selected rectangle or
selected ellipse
(non_empty,x1,y1,x2,y2) = selection_bounds (sample.xcf)
with open(file_name, 'w') as f:
writer = csv.writer(f)
writer.writerow([x1, y1, x2, y2])
main()
------------------------------
--
tamasakai (via www.gimpusers.com/forums)
_______________________________________________
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
- References:
- [Gimp-user] How to get the positions(x, y) (width, depth) of selected rectangle or selected ellipse
- Re: [Gimp-user] How to get the positions(x, y) (width, depth) of selected rectangle or selected ellipse
- Re: [Gimp-user] How to get the positions(x, y) (width, depth) of selected rectangle or selected ellipse
- Re: [Gimp-user] How to get the positions(x, y) (width, depth) of selected rectangle or selected ellipse
- [Gimp-user] How to get the positions(x, y) (width, depth) of selected rectangle or selected ellipse
- Re: [Gimp-user] How to get the positions(x, y) (width, depth) of selected rectangle or selected ellipse
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]