# Loading a png file inside a package

**URL:** <https://discourse.julialang.org/t/loading-a-png-file-inside-a-package/44632>\
**Category:** Visualization\
**Tags:** images\
**Created:** [August 9, 2020, 5:46pm UTC](https://discourse.julialang.org/t/loading-a-png-file-inside-a-package/44632 "2020-08-09T17:46:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![simonschoelly](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simonschoelly/32/21606_2.png) [@simonschoelly](https://discourse.julialang.org/u/simonschoelly)\
**Post date:** [August 9, 2020, 5:46pm UTC](https://discourse.julialang.org/t/loading-a-png-file-inside-a-package/44632/1 "2020-08-09T17:46:59Z")

</div>

In one of my packages I want to load a png file using FileIO. When I try to do that, I get an error message:

```julia
t.qpa.xcb: QXcbConnection: XCB error: 5 (BadAtom), sequence: 498, resource id: 0, major code: 20 (GetProperty), minor code: 0
Errors encountered while loading nothing.
All errors:
===========================================
ArgumentError: Package ImageIO not found in current path:
- Run `import Pkg; Pkg.add("ImageIO")` to install the ImageIO package.

===========================================
ArgumentError: Package ImageMagick not found in current path:
- Run `import Pkg; Pkg.add("ImageMagick")` to install the ImageMagick package.

===========================================

Fatal error:
Error showing value of type Plots.Plot{Plots.GRBackend}:
ERROR: ArgumentError: Package ImageIO not found in current path:
- Run `import Pkg; Pkg.add("ImageIO")` to install the ImageIO package.

```

This message does not go away if I add `ImageMagick` or `ImageIO` to my dependencies, it only goes away if I add one of them to my main environment.

But I would like not to require the user to add such an extra package to the main environment. Is there a way to avoid that? One reason I want to avoid that is, that `ImageIO` has some issues with that PNG file, so I want to enforce `ImageMagick`.

---

<div class="post-metadata">

**Author:** ![simonschoelly](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simonschoelly/32/21606_2.png) [@simonschoelly](https://discourse.julialang.org/u/simonschoelly)\
**Post date:** [August 9, 2020, 5:53pm UTC](https://discourse.julialang.org/t/loading-a-png-file-inside-a-package/44632/2 "2020-08-09T17:53:45Z")

</div>

I might have resolved that by just adding `using ImageMagick` inside my package although I am not sure if I am doing the right thing here
