# Using a barcode to pull an image from a file location

**URL:** <https://forum.inductiveautomation.com/t/using-a-barcode-to-pull-an-image-from-a-file-location/78451>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [August 28, 2023, 2:58pm UTC](https://forum.inductiveautomation.com/t/using-a-barcode-to-pull-an-image-from-a-file-location/78451 "2023-08-28T14:58:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeremy\_Goff](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@Jeremy\_Goff](https://forum.inductiveautomation.com/u/Jeremy_Goff)\
**Post date:** [August 28, 2023, 2:58pm UTC](https://forum.inductiveautomation.com/t/using-a-barcode-to-pull-an-image-from-a-file-location/78451/1 "2023-08-28T14:58:55Z")

</div>

Hello, can a barcode input be used in designer to pull a picture from a file? What would the scripting look like? I apologize I’m new to ignition. This would be used in Vision.

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [August 28, 2023, 3:02pm UTC](https://forum.inductiveautomation.com/t/using-a-barcode-to-pull-an-image-from-a-file-location/78451/2 "2023-08-28T15:02:10Z")

</div>

I would update your question to narrow down vision or perspective.

---

<div class="post-metadata">

**Author:** ![Jeremy\_Goff](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@Jeremy\_Goff](https://forum.inductiveautomation.com/u/Jeremy_Goff)\
**Post date:** [August 28, 2023, 3:06pm UTC](https://forum.inductiveautomation.com/t/using-a-barcode-to-pull-an-image-from-a-file-location/78451/3 "2023-08-28T15:06:01Z")

</div>

Updated. Thank you for the input.

---

<div class="post-metadata">

**Author:** ![Steve\_Laubach](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/steve_laubach/32/60900_2.png) [@Steve\_Laubach](https://forum.inductiveautomation.com/u/Steve_Laubach)\
**Post date:** [August 28, 2023, 3:47pm UTC](https://forum.inductiveautomation.com/t/using-a-barcode-to-pull-an-image-from-a-file-location/78451/4 "2023-08-28T15:47:38Z")

</div>

I haven't had to do this in Ignition but I can hopefully point you in the right direction. In perspective you have a Barcode session event which can handle barcode scanning but you're looking at Vision. I think you probably want to use a keyboard wedge to send barcode information to Ignition and process that with a script.

There's a lot of ways to do this. The image control can load a local image from the machine. Documentation here:  
[https://docs.inductiveautomation.com/display/DOC81/Vision+-+Image](https://docs.inductiveautomation.com/display/DOC81/Vision+-+Image)

A 2D barcode could store a path to an image but I'm going to assume you're working with a 1D barcode that is storing a number. If you are using a 2D barcode you simply put the path in the barcode and send the barcode input to your image control.

Typically what you'll do is you'll make a database or tag of type dataset that has a numeric PK field that the barcode refers to and a string field that stores the path to the image. Alternatively, you could store the image in a database as a BLOB instead of storing a path to the image. I prefer to use strings because I don't like putting BLOBS in databases.

The scripting would be called when a textbox receives a char like CRLF handle the barcode scan by looking up the scanned value in the database/dataset tag and returning the path as a string. That string would then be loaded into the path of your image control.

There is also a barcode control that you may want to have an operator scan. I haven't personally used this control yet but it might be useful for you depending on your use case. If you use a tag of type dataset then you could use that as a datasource for a template repeater which repeats barcode instances so you could dynamically generate barcodes for an operator to scan if you're scanning from the screen.  
[https://docs.inductiveautomation.com/display/DOC81/Vision+-+Barcode](https://docs.inductiveautomation.com/display/DOC81/Vision+-+Barcode)

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [August 28, 2023, 4:03pm UTC](https://forum.inductiveautomation.com/t/using-a-barcode-to-pull-an-image-from-a-file-location/78451/5 "2023-08-28T16:03:09Z")

</div>

Can you also clarify file, is that in a database or filesystem, like on a local storage drive.

---

<div class="post-metadata">

**Author:** ![Jeremy\_Goff](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@Jeremy\_Goff](https://forum.inductiveautomation.com/u/Jeremy_Goff)\
**Post date:** [August 28, 2023, 4:58pm UTC](https://forum.inductiveautomation.com/t/using-a-barcode-to-pull-an-image-from-a-file-location/78451/6 "2023-08-28T16:58:10Z")

</div>

Yes, the file would be on a local storage drive.

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [August 28, 2023, 5:46pm UTC](https://forum.inductiveautomation.com/t/using-a-barcode-to-pull-an-image-from-a-file-location/78451/7 "2023-08-28T17:46:37Z")

</div>

> [@Jeremy\_Goff](#):
>
> can a barcode input be used in designer to pull a picture from a file?

Short answer is yes.

> [@Jeremy\_Goff](#):
>
> What would the scripting look like?

Depends on your needs. Start here [system.file - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/system.file)

> [@Jeremy\_Goff](#):
>
> I apologize I’m new to ignition.

I highly recommend learning through Inductive University, it is free.
