I am trying to get a python component running in parallel with ghpythonlib, however I keep getting an error stating that the ‘Object is in use elsewhere’ which I assume means that the System.Drawing.Bitmap type is not well threaded.
Is there a work around or a better way of doing this?
Thanks in advance.
Matthew.
Input is the Path variable.
My component’s code is:
import System
import ghpythonlib
def getPixel(pixel_number):
x = pixel_number % image_width
y = int(pixel_number / image_height)
pixel = Image.GetPixel(x,y)
I haven’t tried parallel computing but I guess if each process is trying to access the same object then they can clash - is it possible to split the image into N chunks and then process the chunks in parallel ?
I would guess that would be quicker as each process can just iterate over all the available pixels?
From previous posts on this forum I think the first process in the queue is not run in parallel so you may find it is quicker if you add a dummy process first.
GetPixel and SetPixel are inherently super slow. I would consider going with an alternative approach before threading them (as per the hits in the Google search).