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 <ofn...@gmx.com>: > 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 = r'c:\Users\YourName\Documents\Temp\SampleXcfCsv.txt' > > - Using triple quoting: > > file_name='''c:\Users\YourName\Documents\Temp\SampleXcfCsv.txt''' > > - Using forward slashes, that work just as well (the Windows API > understands both types, it's just the command-prompt parser > that insists on backslashes): > > file_name="c:/Users/YourName/Documents/Temp/SampleXcfCsv.txt" > > > On 2/17/20 2:31 AM, ShiroYuki Mot via gimp-user-list wrote: >> 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]) >> > > _______________________________________________ > 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 > _______________________________________________ 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