rhPicture and Python


#1

Will or is rhPicture optimized for V5 and Python?
If so, where can I find some documentation?

I would like to make a plugin that reads data from an image.

Thanks!


(Steve Baer) #2

I doubt it, since rhPicture just wrapped a bunch of .NET functions for RhinoScript. If you want to read data from an image, use system.Drawing.Bitmap class
http://msdn.microsoft.com/en-us/library/System.Drawing.Bitmap(v=vs.110).aspx


#3

Ok, I figured out that I could use rhPicture as it is, it’s just a bit difficult to figure out how it works.

import rhinoscriptsyntax as rs

def NoiseExample():
    ImageFileName = rs.OpenFileName("Open", "ImageFile (*.jpg)|*.jpg|All Files (*.*)|*.*||")
    RhPicture = rs.GetPlugInObject("RhPicture")
    RhPicture.LoadImage(ImageFileName)
    RhPicture.Noise(0.25)
    RhPicture.ShowImage("Greyscale noise applied")
	

NoiseExample()

So now I just need to hack away on this…