Closed datalot-369 closed 3 years ago
check now
Layer > GIML-ML > update...
Steps To Reproduce
Traceback (most recent call last):
File "/usr/lib/gimp/2.0/python/gimpfu.py", line 740, in response
dialog.res = run_script(params)
File "/usr/lib/gimp/2.0/python/gimpfu.py", line 361, in run_script
return apply(function, params)
File "/home/jeanfar/git-clones/GIMP-ML/gimp-plugins/monodepth.py", line 54, in MonoDepth
createResultLayer(img, 'new_output', cpy)
File "/home/jeanfar/git-clones/GIMP-ML/gimp-plugins/monodepth.py", line 40, in createResultLayer
region[:, :] = rlBytes
TypeError: string is wrong length
Traceback (most recent call last):
File "/usr/lib/gimp/2.0/python/gimpfu.py", line 740, in response
dialog.res = run_script(params)
File "/usr/lib/gimp/2.0/python/gimpfu.py", line 361, in run_script
return apply(function, params)
File "/home/jeanfar/git-clones/GIMP-ML/gimp-plugins/monodepth.py", line 54, in MonoDepth
createResultLayer(img, 'new_output', cpy)
File "/home/jeanfar/git-clones/GIMP-ML/gimp-plugins/monodepth.py", line 40, in createResultLayer
region[:, :] = rlBytes
TypeError: string is wrong length
Traceback (most recent call last):
File "/usr/lib/gimp/2.0/python/gimpfu.py", line 740, in response
dialog.res = run_script(params)
File "/usr/lib/gimp/2.0/python/gimpfu.py", line 361, in run_script
return apply(function, params)
File "/home/jeanfar/git-clones/GIMP-ML/gimp-plugins/deblur.py", line 44, in deblur
createResultLayer(img,'deblur_'+layer.name,pred)
File "/home/jeanfar/git-clones/GIMP-ML/gimp-plugins/deblur.py", line 25, in createResultLayer
region[:,:]=rlBytes
TypeError: string is wrong length
Image > Fit Canvas to Layers
All works as expected.
@datalot-369 a warning message has been added in the plugin.
Unexpected fix, but it works.
Thank you Krity!
@kritiksoman There's no need for that error message, though. You can just pass layer.width
and layer.height
to createResultLayer()
and use them instead of image.width
and image.height
here https://github.com/kritiksoman/GIMP-ML/blob/master/gimp-plugins/monodepth.py#L38
Also, have you considered moving the common GIMP<->PyTorch translation functionality into a shared Python module, so it's easier to fix bugs like this? Something like https://github.com/valgur/GIMP-ML-Hub/blob/master/plugins/_plugin_base.py. Feel free to ignore the XMLRPC functionality as that's only relevant if you want to run models in a separate Python 3 process. Using such a module from a plugin script only requires the addition of
import sys
from os.path import dirname, realpath
sys.path.append(realpath(dirname(__file__)))
for the local import to work reliably in GIMP.
Description
Even if the selected layer has no alpha channel, the plugin will give no output if there are alpha pixels in the image.
Steps to reproduce
What happened?
What should happen?
There should be a new layer output of the plugin with the desired effects.
Workaround
File > Create > From Clipboard
Versioning