# Perspective client to display image from FTP server with scripting

**URL:** <https://forum.inductiveautomation.com/t/perspective-client-to-display-image-from-ftp-server-with-scripting/61012>\
**Category:** Ignition\
**Tags:** scripting, perspective\
**Created:** [June 21, 2022, 2:37pm UTC](https://forum.inductiveautomation.com/t/perspective-client-to-display-image-from-ftp-server-with-scripting/61012 "2022-06-21T14:37:17Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andy\_Guias](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@Andy\_Guias](https://forum.inductiveautomation.com/u/Andy_Guias)\
**Post date:** [June 21, 2022, 2:37pm UTC](https://forum.inductiveautomation.com/t/perspective-client-to-display-image-from-ftp-server-with-scripting/61012/1 "2022-06-21T14:37:18Z")

</div>

Hello,

I need to make my Ignition 8.1 Perspective client display an image file that is stored on an FTP server.  
The image file name is dynamically determined by scripting.  
I tried to pass the URL to system.perspective.navigate, but unfortunately the web browsers don’t seem to support FTP anymore.  
If I download the image file with ftplib.ftp.retrbinary and save it in an image file could I display it somehow through scripting?

Thank you!

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 21, 2022, 2:54pm UTC](https://forum.inductiveautomation.com/t/perspective-client-to-display-image-from-ftp-server-with-scripting/61012/2 "2022-06-21T14:54:02Z")

</div>

You can make a WebDev endpoint that performs the FTP retrieval. You should consider not using FTP anymore. If you store your images in a DB, you could use my free Blob Server module instead.

---

<div class="post-metadata">

**Author:** ![Andy\_Guias](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@Andy\_Guias](https://forum.inductiveautomation.com/u/Andy_Guias)\
**Post date:** [June 21, 2022, 3:16pm UTC](https://forum.inductiveautomation.com/t/perspective-client-to-display-image-from-ftp-server-with-scripting/61012/3 "2022-06-21T15:16:52Z")

</div>

Thank you for taking the time to answer my question.  
I will try to install the WebDev module.  
I don’t have much of a choice with the FTP as this is the only way that we can get the KEYENCE cameras to save the images on the network.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 21, 2022, 3:58pm UTC](https://forum.inductiveautomation.com/t/perspective-client-to-display-image-from-ftp-server-with-scripting/61012/4 "2022-06-21T15:58:20Z")

</div>

Keyence cameras have a command channel that can be used to retrieve images. What model do you have?

---

<div class="post-metadata">

**Author:** ![Andy\_Guias](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@Andy\_Guias](https://forum.inductiveautomation.com/u/Andy_Guias)\
**Post date:** [June 21, 2022, 5:26pm UTC](https://forum.inductiveautomation.com/t/perspective-client-to-display-image-from-ftp-server-with-scripting/61012/5 "2022-06-21T17:26:17Z")

</div>

We have KEYENCE XG-X 1200

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 21, 2022, 6:38pm UTC](https://forum.inductiveautomation.com/t/perspective-client-to-display-image-from-ftp-server-with-scripting/61012/6 "2022-06-21T18:38:32Z")

</div>

That model’s communication command reference doesn’t list the **BR** command to retrieve image data. I can’t find any commands that move image data over the command channel at all. Keyence appears to have moved all of that traffic to the undocumented ActiveX interface. ):

---

<div class="post-metadata">

**Author:** ![Andy\_Guias](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@Andy\_Guias](https://forum.inductiveautomation.com/u/Andy_Guias)\
**Post date:** [June 21, 2022, 6:55pm UTC](https://forum.inductiveautomation.com/t/perspective-client-to-display-image-from-ftp-server-with-scripting/61012/7 "2022-06-21T18:55:53Z")

</div>

It is what it is.  
Just frustrating that there are at least two simple ways to do this task (download the image and display it in an Image Component or load the URL in a Web Browser Component) in Vision and none that I can figure out in Perspective. I was really hoping that I can get some ideas on the Forum.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [June 21, 2022, 7:08pm UTC](https://forum.inductiveautomation.com/t/perspective-client-to-display-image-from-ftp-server-with-scripting/61012/8 "2022-06-21T19:08:48Z")

</div>

I guess I’m a little confused as to why you can’t use an Image component?

Taken from the manual [Perspective - Image - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/Perspective+-+Image)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/a/8a00ce83202afc3ecd320dea0eeec3318f0da099.png)

Specifically _It could be a URL to an image on the internet_.

---

<div class="post-metadata">

**Author:** ![Andy\_Guias](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@Andy\_Guias](https://forum.inductiveautomation.com/u/Andy_Guias)\
**Post date:** [June 21, 2022, 7:38pm UTC](https://forum.inductiveautomation.com/t/perspective-client-to-display-image-from-ftp-server-with-scripting/61012/9 "2022-06-21T19:38:55Z")

</div>

When I put the following URL in the props.source of the Image Perspective Component, no image gets displayed:  
ftp://username:password@ip\_address/path/filename.jpg

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 21, 2022, 8:23pm UTC](https://forum.inductiveautomation.com/t/perspective-client-to-display-image-from-ftp-server-with-scripting/61012/10 "2022-06-21T20:23:07Z")

</div>

Your browser likely doesn’t allow cross-origin requests on the same page. That’s for legitimate security reasons. There’s not a lot for Ignition/Perspective to do about it.

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [June 21, 2022, 9:24pm UTC](https://forum.inductiveautomation.com/t/perspective-client-to-display-image-from-ftp-server-with-scripting/61012/11 "2022-06-21T21:24:38Z")

</div>

I’m guessing you could retrieve via [ftplib](https://docs.python.org/2.7/library/ftplib.html) as you noted, save to DB, and display with @pturmel’s Blob Server module if you don’t want to use WebDev.

---

<div class="post-metadata">

**Author:** ![Andy\_Guias](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@Andy\_Guias](https://forum.inductiveautomation.com/u/Andy_Guias)\
**Post date:** [October 20, 2022, 10:47am UTC](https://forum.inductiveautomation.com/t/perspective-client-to-display-image-from-ftp-server-with-scripting/61012/12 "2022-10-20T10:47:38Z")

</div>

Hello again,

If anyone is wondering how to do this, I can share another way that worked for us.  
I ended up using the ftplib library to download the image file into a bytearray then encoded it into base64 and used it to embed the image into the Image Component source like this:

```auto
self.getChild('Image').props.source = 'data:image/jpeg;base64, %s' % base64.b64encode(imageDataBytes)

```

The images displayed are dynamically generated and ephemeral which is why I didn't want to store them again in a database or a web server.
