# File path to image jimp image

**URL:** https://discourse.nodered.org/t/file-path-to-image-jimp-image/79543
**Category:** Developing Nodes
**Created:** [2 July 2023 16:36 UTC](https://discourse.nodered.org/t/file-path-to-image-jimp-image/79543 "2023-07-02T16:36:29Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![gitmacer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gitmacer/32/72584_2.png) [@gitmacer](https://discourse.nodered.org/u/gitmacer)
#### Post date: [2 July 2023 16:36 UTC](https://discourse.nodered.org/t/file-path-to-image-jimp-image/79543/1 "2023-07-02T16:36:29Z")

</div>

I tried to load an image file I pack with my node but if I

```auto
Jimp.read("./test.png")

```

or

```auto
Jimp.read("test.png")

```

I get "Error: ENOENT: no such file or directory, open './test.png'" even though it is right beside the js file  
 ![grafik](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/1/011f4a95a892f38b338035aaf6db9207db680ce4.png)

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [2 July 2023 17:01 UTC](https://discourse.nodered.org/t/file-path-to-image-jimp-image/79543/2 "2023-07-02T17:01:41Z")

</div>

`__dirname` is local to each module. Use path.resolve and path.join to get full path to files relative to your node module.

---

<div class="post-metadata">

### Author: ![gitmacer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gitmacer/32/72584_2.png) [@gitmacer](https://discourse.nodered.org/u/gitmacer)
#### Post date: [2 July 2023 17:03 UTC](https://discourse.nodered.org/t/file-path-to-image-jimp-image/79543/3 "2023-07-02T17:03:50Z")

</div>

```auto
var path = require("path");
var imagePath = path.join(__dirname, "test.png");

Jimp.read(imagePath)

```

Works thank for the help.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [16 July 2023 17:04 UTC](https://discourse.nodered.org/t/file-path-to-image-jimp-image/79543/4 "2023-07-16T17:04:08Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
