GIMP Chat http://gimpchat.com/ |
|
looking for help with a Python script http://gimpchat.com/viewtopic.php?f=9&t=17357 |
Page 1 of 1 |
Author: | KevinYork [ Sun Apr 07, 2019 10:20 pm ] |
Post subject: | looking for help with a Python script |
I'm writing a short Smart-Sharpen script. And it just stops without error message. I'm hoping some kind soul can get the last two lines of code to execute: CODING SUMMARY: 1) SmartSharpen_1() creates a rough edge mask from current layer. [AND WORKS FINE] 2){user manually cleans up any problems with the EDGE-MASK} 3) SmartSharpen_2() uses layer EDGE-MASK for sharpening the layer directly below it with: a) UNSHARP MASK b) invert selection c) GAUSSIAN BLUR d) clear selection Execution stops between 3b and 3c (without an error message). I have included a summary up to the problem; and full code around the problem. I can certainly upload the entire script if that helps. I have tried simplifying the code and throwing extra 'gimp.displays_flush()' as a "Hail Mary!". I also tried running the Gaussian Blur manually. One time it worked; and the time I got 'GIMP Warning: The active layer is not visible." But it was. Even via Python console showed the correct active layer and .visible=True P.S.: is there a better forum for debug help? Code: Select all def SmartSharpen_1(image, layer): |
Author: | Tas_mania [ Sun Apr 07, 2019 11:54 pm ] |
Post subject: | Re: looking for help with a Python script |
Hi Kevin welcome to Gimp Chat. I'm sure there is a Python expert looking at this right now. There is probably just a semantic reason why the code fails to execute. Cheers. |
Author: | ofnuts [ Mon Apr 08, 2019 1:17 am ] |
Post subject: | Re: looking for help with a Python script |
I don't see any obviously wrong. In My Python scripts, I use: Code: Select all image.undo_group_start() That way, some Python problem get caught and displayed in the python console. Otherwise: 1. See here for general debugging techniques if you are on Windows. On Linux and OSX, things are simpler, just start Gimp from a command prompt/terminal, error messages will show up there. Also see here for further questions. 2. Best use standard code formatting if you want other people to read your code 3. Don't play with "image.active_layer". The active layer is the layer you are passed as an argument anyway, and all the calls that act on a layer take the layer as an argument and don't rely on the "active layer". 4. Display flushes are very rarely necessary in Python code |
Author: | Skinnyhouse [ Mon Apr 08, 2019 3:12 am ] |
Post subject: | Re: looking for help with a Python script |
Which version of Gimp are you using Kevin? |
Author: | KevinYork [ Mon Apr 08, 2019 12:55 pm ] |
Post subject: | Re: looking for help with a Python script |
(grrrr..... never mind; I found my stupidity. I was reading documentation on pdb.plug_in_gauss() ...but typed in pdb.plug_in_gauss_iir2(). which has fewer parameters) Script runs fine now... Many thanks for the quick response! As this was my first Python script; I do fear I will be posting more questions. |
Author: | Rod [ Tue Apr 09, 2019 12:25 pm ] |
Post subject: | Re: looking for help with a Python script |
KevinYork wrote: (grrrr..... never mind; I found my stupidity. I was reading documentation on pdb.plug_in_gauss() ...but typed in pdb.plug_in_gauss_iir2(). which has fewer parameters) Script runs fine now... Many thanks for the quick response! As this was my first Python script; I do fear I will be posting more questions. Thats all right. What ever you need were all here to help. |
Page 1 of 1 | All times are UTC - 5 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |