# Recommended Approach for Displaying Third Party Images

**URL:** <https://forum.inductiveautomation.com/t/recommended-approach-for-displaying-third-party-images/40588>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [November 12, 2020, 4:48pm UTC](https://forum.inductiveautomation.com/t/recommended-approach-for-displaying-third-party-images/40588 "2020-11-12T16:48:26Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![tanda](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tanda/32/19154_2.png) [@tanda](https://forum.inductiveautomation.com/u/tanda)\
**Post date:** [November 12, 2020, 4:48pm UTC](https://forum.inductiveautomation.com/t/recommended-approach-for-displaying-third-party-images/40588/1 "2020-11-12T16:48:26Z")

</div>

I have read a few approaches here for displaying third party images in perspective. I would like to know if there is any approach that is favored?

Setup: I’m running Ignition Gateway Edge on Windows 10 as the HMI for a workcell. I am developing in perspective. I have a Cognex camera which is triggered through tags (OPC for new camera, Modbus for old camera) and drops images into a folder on the Gateway Machine.

Approaches:

- I can have the Ignition browser access the designated FTP folder but there are permissions and security issues with the browser accessing a local folder
- I can have the FTP server place images into the Ignition webserver’s folder …/webserver/main but again there are potential permissions and security issues
- could place images in a local Windows 10 website folder and access them from the Ignition webserver

I’m new to administering FTP and WEB sites on Windows 10 so I may be creating some of my own problems.

Are there other better approaches?  
Does the new non-browser based Perspective module solve this elegantly?

Would appreciate any feedback or discussion.

Thank you

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [November 12, 2020, 5:17pm UTC](https://forum.inductiveautomation.com/t/recommended-approach-for-displaying-third-party-images/40588/2 "2020-11-12T17:17:04Z")

</div>

Another approach to consider would be to store the images as blobs in the database.

It would get around some of the permissions problems/concerns. Better? All methods have their pros and cons.

EDIT: My manners are atrocious. Welcome to the forums! 🙂

---

<div class="post-metadata">

**Author:** ![tanda](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tanda/32/19154_2.png) [@tanda](https://forum.inductiveautomation.com/u/tanda)\
**Post date:** [November 12, 2020, 5:49pm UTC](https://forum.inductiveautomation.com/t/recommended-approach-for-displaying-third-party-images/40588/3 "2020-11-12T17:49:58Z")

</div>

Great suggestion. I think at some point I will have to cross that bridge since inspection images may need to get stored in the database for future reporting.

My reluctance to do that right now is that the images are being generated by the Cognex software/firmware running on the camera and it can’t directly drop it into the database. That still leaves me with accessing the images from within Ignition…

Maybe I need to be looking into file and database manipulate first to get the images where I need them.

I’m new to Ignition and have sold my employer on using it for a couple work cells, so when it comes to learning Ignition, I’m kinda drinking from the fire hose!

---

<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:** [November 12, 2020, 6:00pm UTC](https://forum.inductiveautomation.com/t/recommended-approach-for-displaying-third-party-images/40588/4 "2020-11-12T18:00:50Z")

</div>

Yet another option is to use the WebDev module with it’s `Mounted Folder` option - anything in a folder will be automatically served up by Ignition (dynamically, when requested).

---

<div class="post-metadata">

**Author:** ![tanda](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tanda/32/19154_2.png) [@tanda](https://forum.inductiveautomation.com/u/tanda)\
**Post date:** [November 12, 2020, 6:36pm UTC](https://forum.inductiveautomation.com/t/recommended-approach-for-displaying-third-party-images/40588/5 "2020-11-12T18:36:05Z")

</div>

I’m not sure WebDev is available to me on a stand alone Ignition Edge installation.

---

<div class="post-metadata">

**Author:** ![nathanielbrown](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nathanielbrown/32/9856_2.png) [@nathanielbrown](https://forum.inductiveautomation.com/u/nathanielbrown)\
**Post date:** [November 12, 2020, 9:49pm UTC](https://forum.inductiveautomation.com/t/recommended-approach-for-displaying-third-party-images/40588/6 "2020-11-12T21:49:49Z")

</div>

I have actually completed something similar to what you are trying to do using some custom .NET Core applications. You could look at creating an application that finds new images in a given folder and then uploads/copies into a database. If you have Microsoft SQL Server, FileTables is one such solution to keep images as files without converting to bytes. You could then have an [ASP.NET](http://ASP.NET) application return the file of the image requested when it receives an HTTP GET request. This allows the use of the Perspective Image component - all you have to do is provide the source link for the image.

---

<div class="post-metadata">

**Author:** ![tanda](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tanda/32/19154_2.png) [@tanda](https://forum.inductiveautomation.com/u/tanda)\
**Post date:** [November 13, 2020, 1:15am UTC](https://forum.inductiveautomation.com/t/recommended-approach-for-displaying-third-party-images/40588/7 "2020-11-13T01:15:30Z")

</div>

There are a few approaches along those lines that I’m exploring. One simple one that I played with for a few hours was to simply move files into a local webserver directory and then access them through an HTTP GET. This can work but I’m still seeking something that can just be easily set up on the work cell laptop and not depend on a lot of other infrastructure.

---

<div class="post-metadata">

**Author:** ![nathanielbrown](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nathanielbrown/32/9856_2.png) [@nathanielbrown](https://forum.inductiveautomation.com/u/nathanielbrown)\
**Post date:** [November 13, 2020, 3:04am UTC](https://forum.inductiveautomation.com/t/recommended-approach-for-displaying-third-party-images/40588/8 "2020-11-13T03:04:27Z")

</div>

If keeping everything local to the laptop is the most important aspect, I think your local web server on the laptop could still be the best current solution then (if it is able to present images in the Perspective Image component). Out of curiosity, what is the current problem that you see with the local web server solution that you developed (e.g. ease of deployment, file management, etc.)?

---

<div class="post-metadata">

**Author:** ![tanda](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tanda/32/19154_2.png) [@tanda](https://forum.inductiveautomation.com/u/tanda)\
**Post date:** [November 16, 2020, 4:53pm UTC](https://forum.inductiveautomation.com/t/recommended-approach-for-displaying-third-party-images/40588/9 "2020-11-16T16:53:48Z")

</div>

I’m trying to develop a general solution for us to deploy laptops to use as local work cell HMI/SCADA. Most of the work cells employ some kind of visual data collection/analysis using Cognex cameras which I would like to display seamlessly with Ignition. The problems I’m running into are most likely due to my inexperience with Windows 10 networking, permissions and the company’s third party firewall software. With Perspective running in a browser, I need to have a shared location where the Cognex camera can use FTP to store images and Perspective, running in the Ignition browser, can have access to those images. I have not explored the new Kiosk mode, where I believe Perspective is running as a native app rather than in a browser, that could be another option.

---

<div class="post-metadata">

**Author:** ![nathanielbrown](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nathanielbrown/32/9856_2.png) [@nathanielbrown](https://forum.inductiveautomation.com/u/nathanielbrown)\
**Post date:** [November 16, 2020, 10:28pm UTC](https://forum.inductiveautomation.com/t/recommended-approach-for-displaying-third-party-images/40588/10 "2020-11-16T22:28:08Z")

</div>

I don’t think the Perspective Workstation system allows for local file system access still, unfortunately (I could be wrong, or this could be a feature coming). However, the Vision image component does allow for accessing client file paths. [https://docs.inductiveautomation.com/display/DOC81/Vision±+Image](https://docs.inductiveautomation.com/display/DOC81/Vision+-+Image)

If you are set on using Perspective though, I still would suggest that you look at an [ASP.NET](http://ASP.NET) application - you can create one yourself in Visual Studio Code that returns an image relatively easily (and publish as a self-contained application that you can just start and run on your workstations). Below is a snippet of a controller from one that I just put together to return a file with filename “image1.jpg”. - the request was just [https://localhost:5001/Image/1](https://localhost:5001/Image/1)

```auto
        public async Task<IActionResult> Download(long id)
        {
            var filePathPrefix = "C:\\image" + id + ".jpg";

            Image imageHolder = Image.FromFile(filePathPrefix);

            var memory = new MemoryStream();

            imageHolder.Save(memory, System.Drawing.Imaging.ImageFormat.Jpeg);
            memory.Position = 0;

            return File(memory, "image/jpeg", "file" + id + ".jpg");
        }

```

The neat part is that is about all the code there is to it - I modified Microsoft’s web API tutorial to make the above code the action of the GET request in their template (and added [System.IO](http://System.IO) and System.Drawing.Imaging namespaces). Check out Microsoft’s template for more info on getting started:  
[https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-web-api?view=aspnetcore-3.1&tabs=visual-studio-code](https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-web-api?view=aspnetcore-3.1&tabs=visual-studio-code)

However, if you already have some kind of a local file server that can return files via HTTP requests, then none of this is needed 😃 (unless you want to have some degree of customization).

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [November 16, 2020, 10:31pm UTC](https://forum.inductiveautomation.com/t/recommended-approach-for-displaying-third-party-images/40588/11 "2020-11-16T22:31:50Z")

</div>

If these machines will have Python 3 installed you can start a simple HTTP server like this:

```auto
python -m http.server -b localhost -d /path/to/images

```

---

<div class="post-metadata">

**Author:** ![nathanielbrown](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nathanielbrown/32/9856_2.png) [@nathanielbrown](https://forum.inductiveautomation.com/u/nathanielbrown)\
**Post date:** [November 17, 2020, 12:13am UTC](https://forum.inductiveautomation.com/t/recommended-approach-for-displaying-third-party-images/40588/12 "2020-11-17T00:13:38Z")

</div>

> [@Kevin.Herron](#):
>
> python -m http.server -b localhost -d /path/to/images

That's quite a bit simpler of a solution than mine 😆. Didn't realize there are HTTP server capabilities for Python!

---

<div class="post-metadata">

**Author:** ![tanda](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tanda/32/19154_2.png) [@tanda](https://forum.inductiveautomation.com/u/tanda)\
**Post date:** [November 17, 2020, 4:09am UTC](https://forum.inductiveautomation.com/t/recommended-approach-for-displaying-third-party-images/40588/13 "2020-11-17T04:09:41Z")

</div>

Nathaniel,

Thank you for all the help! Some great ideas and I’ve filed them away for when they might be appropriate.

I tried Kevin’s python webserver approach (I didn’t realize this was baked into Python 3 either!) and it worked just fine here in my home shop where I’m playing with everything via the Maker edition. It’s an elegant solution for me because I can let Cognex put the images in their program directory or wherever default and just point to it with the Python server.

Thanks again for all of the responses. I’m liking this community and that’s a good thing since I’m diving headlong into Ignition.

---

<div class="post-metadata">

**Author:** ![tanda](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tanda/32/19154_2.png) [@tanda](https://forum.inductiveautomation.com/u/tanda)\
**Post date:** [November 17, 2020, 4:12am UTC](https://forum.inductiveautomation.com/t/recommended-approach-for-displaying-third-party-images/40588/14 "2020-11-17T04:12:57Z")

</div>

Kevin,

I’ve given this a try in my home shop and it works great! Thank you.  
I can tell you this, if the work cell PC’s at the job don’t have Python 3 installed… they will have it installed tomorrow morning! haha

Regards,  
Tanda

---

<div class="post-metadata">

**Author:** ![tanda](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tanda/32/19154_2.png) [@tanda](https://forum.inductiveautomation.com/u/tanda)\
**Post date:** [November 17, 2020, 5:11am UTC](https://forum.inductiveautomation.com/t/recommended-approach-for-displaying-third-party-images/40588/15 "2020-11-17T05:11:39Z")

</div>

For anyone following along, here is a brief summary of how I implemented this solution:

I use Tags in Ignition to poke a module number and inspection point (terms unique to my application) into the Cognex Spreadsheet via OPC or Modbus (for those unfamiliar with Cognex, a spreadsheet is how Cognex cameras store/present the code for an inspection job). I use these values in the Cognex code to build a unique filename and then when I trigger the camera, also through a tag in Ignition, I’ve coded the camera to then send the image to a folder via FTP.

Using Kevin’s suggestion of creating a simple http.server using python  
See above: [Recommended Approach for Displaying Third Party Images](http://forum.inductiveautomation.com/t/recommended-approach-for-displaying-third-party-images/40588/11)  
I point the simple python webserver at the directory where the images are being stored and bind it to a local IP address on the work cell PC that is running Ignition Gateway. The work cell PC has a separate ethernet port for talking with cameras, robots etc. in the cell and that is all behind a router in the work cell so the simple python server is pretty secure.  
Boom! now I can use a memory tag to build the “[http://localhost:8000/MODxxINSPxx](http://localhost:8000/MODxxINSPxx)” value for an image component and display inspection images as they are being captured.  
My Ignition App is now driving all of the file naming, camera triggering, and robot positioning, based on a recipe file I’ve had the operator load in using a “file upload” component.

Thanks everyone for all the help!  
-Tanda

---

<div class="post-metadata">

**Author:** ![zanouba603](https://avatars.discourse-cdn.com/v4/letter/z/df788c/32.png) [@zanouba603](https://forum.inductiveautomation.com/u/zanouba603)\
**Post date:** [March 31, 2021, 3:51pm UTC](https://forum.inductiveautomation.com/t/recommended-approach-for-displaying-third-party-images/40588/16 "2021-03-31T15:51:19Z")

</div>

hello Tanda,  
I’ve been struggling to find out how can i integrate python with Cognexx, i would be so grateful if you could help me  
i tried to connect with Cognex via telnet but the camera doesn’t receive commands

---

<div class="post-metadata">

**Author:** ![tanda](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tanda/32/19154_2.png) [@tanda](https://forum.inductiveautomation.com/u/tanda)\
**Post date:** [April 1, 2021, 6:38am UTC](https://forum.inductiveautomation.com/t/recommended-approach-for-displaying-third-party-images/40588/17 "2021-04-01T06:38:01Z")

</div>

Some of the newer cameras have an OPC server built in. However, I haven’t done much with that yet.  
I’ve found the easiest way to connect a camera with Ignition is through Modbus. If you are using Insight Explorer to develop your project, and your camera firmware is newer than 5.3.0, there is a setup for Modbus communications. Here is a link to a cognex page on the register architecture:  
[https://support.cognex.com/docs/is\_574/web/EN/ise/Content/Communications\_Reference/ModbusTCP\_5x.htm](https://support.cognex.com/docs/is_574/web/EN/ise/Content/Communications_Reference/ModbusTCP_5x.htm)  
If you need to capture images from the camera, maybe after triggering it from the Modbus link, there is a function to do an FTP write that will store the image off onto an ftp server.  
Hope this helps a bit. I’m fairly new to this myself so certainly not an expert. I’m just relating what I’ve discovered.

---

<div class="post-metadata">

**Author:** ![tanda](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tanda/32/19154_2.png) [@tanda](https://forum.inductiveautomation.com/u/tanda)\
**Post date:** [April 6, 2021, 5:02am UTC](https://forum.inductiveautomation.com/t/recommended-approach-for-displaying-third-party-images/40588/18 "2021-04-06T05:02:11Z")

</div>

I replied a few days ago and just noticed that it was a separate post rather than a reply directly to you. I’m replying here so you get an alert.

---

<div class="post-metadata">

**Author:** ![zanouba603](https://avatars.discourse-cdn.com/v4/letter/z/df788c/32.png) [@zanouba603](https://forum.inductiveautomation.com/u/zanouba603)\
**Post date:** [April 6, 2021, 6:43am UTC](https://forum.inductiveautomation.com/t/recommended-approach-for-displaying-third-party-images/40588/19 "2021-04-06T06:43:27Z")

</div>

Oh right ,  
I need to do the image processing Of the images captured from the camera cognex using python and openCv, so should i use ftp Server or modbus tcp to communicate ?  
Thank you very much

---

<div class="post-metadata">

**Author:** ![tanda](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tanda/32/19154_2.png) [@tanda](https://forum.inductiveautomation.com/u/tanda)\
**Post date:** [April 9, 2021, 7:31pm UTC](https://forum.inductiveautomation.com/t/recommended-approach-for-displaying-third-party-images/40588/20 "2021-04-09T19:31:54Z")

</div>

I think I would use the built in ftp transfer from the Cognex to an ftp server. Then you have the files where you can run your analysis on them.

[Next page](https://forum.inductiveautomation.com/t/recommended-approach-for-displaying-third-party-images/40588.md?page=2)
