cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

.NET SDK

droach
7-Bedrock

.NET SDK

I have a .NET SDK edge application written in C#.  I am using the GetNamedPropertyValuesVTQ call to return a set of properties from a THING.  One of the properties is an image.  Casting to IMAGEPRIMATIVE or byte[] shows a length of 0 in debug mode.  Double question set is:

1. How can you convert an ImagePrimative to a C# image to be able to persist the image to client folder. 

2. Is there an alternative way to download the image property into an edge application (C#)?

ACCEPTED SOLUTION

Accepted Solutions
pgrodowski
14-Alexandrite
(To:droach)

Hello,

 

The cast seems to fail (return 0) because the image returned from the InfoTable is encoded in base64.

First decoding and then casting on the result may work (untested). directly casting does not work because there might not be a constructor / operator for the target type you're casting to that accepts base64 encoded data . You should then be able to save the type (for example if you choose a byte array) to a file, which will represent the ImagePrimitive.

 

Please let me know if you have any questions.

 

Regards,

Pascal

View solution in original post

2 REPLIES 2
pgrodowski
14-Alexandrite
(To:droach)

Hello,

 

The cast seems to fail (return 0) because the image returned from the InfoTable is encoded in base64.

First decoding and then casting on the result may work (untested). directly casting does not work because there might not be a constructor / operator for the target type you're casting to that accepts base64 encoded data . You should then be able to save the type (for example if you choose a byte array) to a file, which will represent the ImagePrimitive.

 

Please let me know if you have any questions.

 

Regards,

Pascal

slangley
23-Emerald II
(To:pgrodowski)

Hi @droach.

 

If the response provided by @pgrodowski answered your question, please mark it as the Accepted Solution for the benefit of others with the same question.

 

Regards.

 

--Sharon

Announcements


Top Tags