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

2020-02-17 Thread tamasakai
>Dear Ofnuts. Thanks a lot! :) > >I wrote just the basic code, because he seems to be a beginner. >But your comments will surely help him. > > >2020-02-17 22:11 GMT+09:00, Ofnuts : Thank you all I tried the script as follows. I could get the selection's position and size! Thanks again. But the

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

2020-02-17 Thread ShiroYuki Mot via gimp-user-list
Dear Ofnuts. Thanks a lot! :) I wrote just the basic code, because he seems to be a beginner. But your comments will surely help him. 2020-02-17 22:11 GMT+09:00, Ofnuts : > If you register your script properly, the Image will be in the function > arguments when the script is called from the

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

2020-02-17 Thread Ofnuts
If you register your script properly, the Image will be in the function arguments when the script is called from the menu, no need to read it out from the title bar. Also, you can avoid a lot of back-slashing by either: - Using "raw" notation for string literals:     file_name =

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

2020-02-16 Thread tamasakai
Shiro Yuki -san, Thanks a lot. As you mentioned, I am a Japanese. I asked the same question on Yahoo! Chie-bukuro but there was no good answer. Then I signed up here. I will learn Python more to achieve my job according to your advice. Thank you very much. >If you can read the Japanese, please

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

2020-02-16 Thread ShiroYuki Mot via gimp-user-list
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 : > Please learn the basic scripting of GIMP Python. > See as follows. >

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

2020-02-16 Thread ShiroYuki Mot via gimp-user-list
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

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

2020-02-16 Thread tamasakai
>Dear Ofnuts. Thanks! ;) There was a good way! > >Is it OK? >2020年2月14日(金) 16:34 Ofnuts : 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

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

2020-02-14 Thread ShiroYuki Mot via gimp-user-list
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 : > Uh? You can write to a file from the script, using the regular I/O > functions. > > For more structured

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

2020-02-13 Thread Ofnuts
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

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

2020-02-13 Thread Ofnuts
See: non_empty, x1, y1, x2, y2 = pdb.gimp_selection_bounds(image) On 2/14/20 7:14 AM, tamasakai wrote: How to get the positions(x,y) (width, depth) of selected rectangle or selected ellipse I read such numbers on GIMP and write them in Excel files but sometime human error occurs. I want to

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

2020-02-13 Thread ShiroYuki Mot via gimp-user-list
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

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

2020-02-13 Thread tamasakai
How to get the positions(x,y) (width, depth) of selected rectangle or selected ellipse I read such numbers on GIMP and write them in Excel files but sometime human error occurs. I want to automate the process. I read instructions of Python-Fu but there so many functions then I could not find out