Jump to content
Developer Wiki and Function Reference Links ×

Importing Image


AlanW

Recommended Posts

Alan,

you tried to use the path as point for the image import function :D

def RunNode(self):
#import os
importPt_ = self.Params.importPt.value		

# Changed GetFile by GetFileN
succes, fileName = vs.GetFileN('???', None, None)

if succes:
	#fullReadPath, fullWritePath, readFileExists, writeFileExists, locked, hasReadPermission, hasWritePermission, hasFolderPermission = vs.GetFileInfo(fileName)
	#name, ext = os.path.splitext( fileName )
	#if ext.lower() == '.png' or ext.lower() == '.jpg':
	#imagePath = os.path.join( fullReadPath, fileName )
	hImage = vs.ImportImageFile( fileName, importPt_ )

	# This line should be within the if block otherwise you could return the wrong object!
	self.Params.hImage.value = hImage

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...