LabVIEW Cloud Toolkits

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview Azure Download to local computer

Solved!
Go to solution

I have couple of images files needed to be downloaded from azure cloud to local computer. Is there "Get Blob" function achieve it? What I found is: 

Hellohzd1_0-1695239900295.png

then, I need to convert this text message to *.jpg file format in some way. 

Is there better way than this? it can upload a file to azure blob as following: 

Hellohzd1_1-1695240031306.png

I just can not find reverse function in tool kit. 

Can someone help me out please? 

Many Thanks. 

 

 

0 Kudos
Message 1 of 10
(2,479 Views)

Which toolkit are you using for Azure ? If you were using the AWS Toolkit, in the S3, Bucket section there is: Put object from file and Get object to file. I suspect Azure is a different interface. When you say "convert this text message to *.jpg file format" what do you mean? If you have a text file do you want to create an .jpg file that is a picture of how the text would look on a screen. I am sure this is not what you want.

0 Kudos
Message 2 of 10
(2,438 Views)

Thanks for your replace. 

I am use azure tool kit as following since I subscripted azure blob storage service. 

Hellohzd1_0-1695316549994.png

since I can not use xcopy copy command or something to achieve it. The most similar function is: copy, x-ms-copy-source which copy one blob to other container location. It can not copy to local computer. 

So, I might need to open the jpg file in the cloud, and save it back to local computer and reserve as jpg file to be opened as image. 

Toolkit has two open function, one is open the file as text file and the other is as mega data file. 

Hellohzd1_1-1695316908706.png

I tried to display mega data as image as following and it can not accepted it: 

Hellohzd1_2-1695317116576.png

I can not access: 

Hellohzd1_3-1695317229178.png

 

So, the only way is to display the text file to image and save image back to image jpg file. 

I am struggling on this. 

Is there other way? 

Thanks. 

 

0 Kudos
Message 3 of 10
(2,433 Views)

Dear colleague

 

It is true that the Azure Toolkit does not contain an example for downloading a file from a container, but it is quite straightforward to adapt the "Upload" example to do the oposite function.

 

I send attached one simple version (v. LabVIEW 2021) to illustrate the use of the "Get Blob" function.

 

Regards,

 

Aitzol Ezeiza (University of the Basque Country UPV/EHU)

0 Kudos
Message 4 of 10
(2,423 Views)

Could you please save it as Labview 2018 version since I cannot open it?

Many thanks. 

0 Kudos
Message 5 of 10
(2,418 Views)

I could not test it, but it has been saved for the 18 version.

0 Kudos
Message 6 of 10
(2,411 Views)

I took the Upload file to Azure Container.vi example and swapped it around to Download file from Azure Container.vi provided here as is in LV2018. Let me know if it works. I do not have an Azure account so cannot test it.

0 Kudos
Message 7 of 10
(2,410 Views)

It can write file out. However, the file which is written out cannot preserve jpg file properties. It shows: 

Hellohzd1_0-1695385618946.png

the actual file is: 

Hellohzd1_1-1695385711672.png

the image file is not corrupted which upload code in labview example and the operations between azure account and local computer. I tried load jpg file using labview upload example and download using azure tool. The downloaded jpg file is ok. 

Jpg file property has been lost in binary written process. I don't know why the labview upload code does not corrupt it as well.

 

I tried: open jpg file using binary reading and write it to another file will not work as well though it has jpg file extension. 

 

Do anybody have idea?

Many Thanks.   

 

 

 

 

0 Kudos
Message 8 of 10
(2,383 Views)

Let me tell you a story: I do not have an Azure account but I do have an Amazon AWS account, so I thought I could test that and maybe learn something - I did. Starting with the Upload file to Bucket example vi, I rearranged this to give a Download file from bucket. I got the same error as you "It appears we do not support this file format." Looking at the properties of the original and downloaded file, I see the the downloaded file is 4 bytes longer. The problem comes from the "Write to Binary File.vi" there is an optional input "prepend array or string size? (T)" connect a constant to this input and set it to false.

SteveE_1-1695460969135.png

Now the downloaded file matches the original file and thus can be open and viewed.

New copy of "Download File from Azure Container LV2018 v2.vi" attached.

Please test this with your Azure account and see if it works for you ?

Just out of interest why are you using Microsoft Azure rather than Amazon AWS?

Message 9 of 10
(2,353 Views)
Solution
Accepted by topic author Hellohzd1

Thanks for your help. It works.

 

I already developed one tool to convert image files to binary file based on: 

 

https://forums.ni.com/t5/Example-Code/Save-an-image-as-binary-file-and-convert-the-loaded-image-back...
Save an image as binary file and convert the loaded image back to a LabVIEW picture (one solution: load picture using utility file and output it as binary file;laod will be ok. shortcoming: one more step, no way to check;)

 

I tried to compare the content of binary file previously. I should keep on studying it. 

 

Our IT guy provide azure solution for us, plus all our company use Microsoft outlook, team. it is easy to be managed in my feeling for them. 

 

Thank you again for your help. I might help someone as as well. 

 

0 Kudos
Message 10 of 10
(2,335 Views)