# Importing PIL library python

**URL:** <https://forum.inductiveautomation.com/t/importing-pil-library-python/95886>\
**Category:** Ignition\
**Tags:** python, scripting, ignition81, perspective\
**Created:** [September 12, 2024, 8:07am UTC](https://forum.inductiveautomation.com/t/importing-pil-library-python/95886 "2024-09-12T08:07:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![g.cascales](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@g.cascales](https://forum.inductiveautomation.com/u/g.cascales)\
**Post date:** [September 12, 2024, 8:07am UTC](https://forum.inductiveautomation.com/t/importing-pil-library-python/95886/1 "2024-09-12T08:07:43Z")

</div>

Hello there!

My final aim is to overlay two pictures of the same size (stored in the same PC Ignition is running): one picture will act as a "square" frame, and the other as the main content.

I have searched on the Internet and found this ([Overlay two same sized images in Python - Stack Overflow](https://stackoverflow.com/questions/10640114/overlay-two-same-sized-images-in-python)) using a python library.

I was wondering the following:

1. Is there an easy way to do the overlay with an embedded Ignition/Perspective tool/functionality?

2. I am not sure about how to import the PIL library (3rd party). I am aware that I have to copy some files into " `C:\Program Files\Inductive Automation\Ignition\user-lib\pylib`", but no idea about what files or folder to copy. In the Internet I can find the source in .tar.gz format, but not in a .py or .zip. Could anyone clarify or help me here?

Another aspect is that I think this library has some C instances, which can cause the library to not work in Ignition. Could this be confirmed?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [September 12, 2024, 8:30am UTC](https://forum.inductiveautomation.com/t/importing-pil-library-python/95886/2 "2024-09-12T08:30:37Z")

</div>

If the lib uses C, it won't work. Ignition uses Jython, which runs on a JVM. So you can use Java, but not C.

Can you show an example of these 2 images ?

---

<div class="post-metadata">

**Author:** ![g.cascales](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@g.cascales](https://forum.inductiveautomation.com/u/g.cascales)\
**Post date:** [September 12, 2024, 9:41am UTC](https://forum.inductiveautomation.com/t/importing-pil-library-python/95886/3 "2024-09-12T09:41:58Z")

</div>

Hi @pascal.fragnoud ,

thanks for your reply.

The final picture would be something like:

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/1/b1bf68662652dbd7bbaad92413461d3fb2f1ace4.jpeg)

Where one picture/layer will be the base image (bolts and plastic bags), and the other one will be a no-background image with the coloured squares in defined positions.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [September 12, 2024, 9:57am UTC](https://forum.inductiveautomation.com/t/importing-pil-library-python/95886/4 "2024-09-12T09:57:37Z")

</div>

Just put the image in a coordinate container and use labels to make the rectangles:

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/d/8d437dfbf5c18440a18a053348695e2b87343329.jpeg)

I added the purple one, it's a simple label with no text and this style: `border: solid 6px purple`

It makes it super easy to change things.  
ie, with `border: dotted 6px purple`  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/5/a561fe3c6b474af69eac9b28e9ce8c562c6bec67.png)

with `border: dashed 10px red` and `border-radius: 50`  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/e/1eb4f59dd70a8baf92fb5ffe7568568aa9f9a90c.png)

---

<div class="post-metadata">

**Author:** ![g.cascales](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@g.cascales](https://forum.inductiveautomation.com/u/g.cascales)\
**Post date:** [September 12, 2024, 10:12am UTC](https://forum.inductiveautomation.com/t/importing-pil-library-python/95886/5 "2024-09-12T10:12:01Z")

</div>

Hi @pascal.fragnoud ,

yes, that would work for my case now!

Thanks!!

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [September 12, 2024, 10:34am UTC](https://forum.inductiveautomation.com/t/importing-pil-library-python/95886/6 "2024-09-12T10:34:44Z")

</div>

Looks a bit like this one, maybe it gives inpiration

> [@SVG view in Perspective](https://forum.inductiveautomation.com/t/svg-view-in-perspective/78661/10):
>
> ah i see. there seems to be a margin inside the iframe. idk how that got there, you could just add a margin on the image to compensate use these for width and height of the image calc( 100% - 16px) (you can ignore the warning the designer gives) and a margin of 8px
