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

.NET SDK

SOLVED
Level 6

.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#)?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: .NET SDK

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

2 REPLIES 2
Highlighted

Re: .NET SDK

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

Re: .NET SDK

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