# Can read photo in but not process

**URL:** <https://discourse.nodered.org/t/can-read-photo-in-but-not-process/42639>\
**Category:** General\
**Created:** [14 March 2021 19:46 UTC](https://discourse.nodered.org/t/can-read-photo-in-but-not-process/42639 "2021-03-14T19:46:08Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![fugit185](https://avatars.discourse-cdn.com/v4/letter/f/a87d85/32.png) [@fugit185](https://discourse.nodered.org/u/fugit185)\
**Post date:** [14 March 2021 19:46 UTC](https://discourse.nodered.org/t/can-read-photo-in-but-not-process/42639/1 "2021-03-14T19:46:08Z")

</div>

I can take photo in using node-red-contrib-image-tools image viewer but when I try to process it nothing happens. It works small sample photos like 160x30 but when I take in 600x508 and try to prosess it, nothing happens.

Photos are from rain radar and I try to make telegam alarm when rain clouds are closing my position. Target is to read photo in and analyse RGB values in order to find values typical for rain cloud and then calculate movement and distance to my home.

I'm running NR in Raspberry Pi 3B so it can be memory issue. One choise could could be to split it to 600\*1 row and analyse row by row, but so far I have not managed to do it.

Here is flow

```auto
[{"id":"ff6529a4.32df58","type":"split","z":"2ef12be.dc2abd4","name":"split all to ones","splt":",","spltType":"str","arraySplt":"1","arraySpltType":"len","stream":true,"addname":"","x":940,"y":640,"wires":[["b83e77d5.827fd8"]]},{"id":"b83e77d5.827fd8","type":"join","z":"2ef12be.dc2abd4","name":"join 3 i.e. RGB values","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":",","joinerType":"str","accumulate":false,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1080,"y":580,"wires":[["449cc8f.c062338"]]},{"id":"449cc8f.c062338","type":"join","z":"2ef12be.dc2abd4","name":"join 600 RGB values i.e. one row","mode":"custom","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":";","joinerType":"str","accumulate":false,"timeout":"","count":"600","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1240,"y":640,"wires":[[]]},{"id":"fe650836.8e3198","type":"file in","z":"2ef12be.dc2abd4","name":"Read photo in RGB format","filename":"kuva.txt","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":660,"y":640,"wires":[["63706fb2.ae591"]]},{"id":"328fb30b.cb7e3c","type":"inject","z":"2ef12be.dc2abd4","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":580,"y":580,"wires":[["fe650836.8e3198"]]},{"id":"63706fb2.ae591","type":"change","z":"2ef12be.dc2abd4","name":"Remove [and]","rules":[{"t":"change","p":"payload","pt":"msg","from":"[","fromt":"str","to":"","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"]","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":820,"y":580,"wires":[["ff6529a4.32df58"]]}]

```

---

<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:** [14 March 2021 20:16 UTC](https://discourse.nodered.org/t/can-read-photo-in-but-not-process/42639/2 "2021-03-14T20:16:03Z")

</div>

> [@fugit185](#):
>
> I can take photo in using node-red-contrib-image-tools image viewer but when I try to process it nothing happens. It works small sample photos like 160x30 but when I take in 600x508 and try to prosess it, nothing happens.

Nothing happens? No errors? Where does it "stop" (i.e. use debug nodes after every node - what do you see?

I cant test anything for you as ...

1. You only posted this...  

2. You provided no sample file (i.e. the `kuva.txt` file that "does nothing")

---

<div class="post-metadata">

**Author:** ![fugit185](https://avatars.discourse-cdn.com/v4/letter/f/a87d85/32.png) [@fugit185](https://discourse.nodered.org/u/fugit185)\
**Post date:** [14 March 2021 20:20 UTC](https://discourse.nodered.org/t/can-read-photo-in-but-not-process/42639/3 "2021-03-14T20:20:26Z")

</div>

![img](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/2/d231381a51d58f701ee8c8781a91c6a59350317c.png)

---

<div class="post-metadata">

**Author:** ![fugit185](https://avatars.discourse-cdn.com/v4/letter/f/a87d85/32.png) [@fugit185](https://discourse.nodered.org/u/fugit185)\
**Post date:** [14 March 2021 20:22 UTC](https://discourse.nodered.org/t/can-read-photo-in-but-not-process/42639/4 "2021-03-14T20:22:50Z")

</div>

it stops after "Remove [and]" node. I had debug in all nodes but removed for simplicity

---

<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:** [14 March 2021 20:27 UTC](https://discourse.nodered.org/t/can-read-photo-in-but-not-process/42639/5 "2021-03-14T20:27:48Z")

</div>

But that is an image not a txt file? as your file node is set to read.

and there is no image-tools nodes in the flow you posted.

Maybe start again - what are you trying to do? read colour data from a specific X/Y postition?

If so, then maybe this will help...

> [@Extract color from location on image](https://discourse.nodered.org/t/extract-color-from-location-on-image/26344/2):
>
> Assuming your image isn't a simple bitmap in a buffer (where you could calculate the offset to the pixel) you can use node-red-contrib-image-tools. If you can have the X & Y position, you can get the colour using node-red-contrib-image-tools Inject (X&Y) - image node (return image) - function node - debug Function. .. msg.image = msg.payload; var x=msg.pixel.x; var y=msg.pixel.y; msg.payload = msg.image.getPixelColor(x, y); // returns the colour of that pixel e.g. 0xFFFFFFFF return msg; EDI…

---

<div class="post-metadata">

**Author:** ![fugit185](https://avatars.discourse-cdn.com/v4/letter/f/a87d85/32.png) [@fugit185](https://discourse.nodered.org/u/fugit185)\
**Post date:** [14 March 2021 20:31 UTC](https://discourse.nodered.org/t/can-read-photo-in-but-not-process/42639/6 "2021-03-14T20:31:37Z")

</div>

As a new user I can not upload the file

---

<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:** [14 March 2021 20:40 UTC](https://discourse.nodered.org/t/can-read-photo-in-but-not-process/42639/7 "2021-03-14T20:40:44Z")

</div>

You can now.

However, answer the questions in my previous post.

---

<div class="post-metadata">

**Author:** ![fugit185](https://avatars.discourse-cdn.com/v4/letter/f/a87d85/32.png) [@fugit185](https://discourse.nodered.org/u/fugit185)\
**Post date:** [14 March 2021 20:59 UTC](https://discourse.nodered.org/t/can-read-photo-in-but-not-process/42639/8 "2021-03-14T20:59:39Z")

</div>

Thanks I got that "exract color from location on image" flow example working. I think I can use that for my project.

---

<div class="post-metadata">

**Author:** ![fugit185](https://avatars.discourse-cdn.com/v4/letter/f/a87d85/32.png) [@fugit185](https://discourse.nodered.org/u/fugit185)\
**Post date:** [17 March 2021 11:34 UTC](https://discourse.nodered.org/t/can-read-photo-in-but-not-process/42639/9 "2021-03-17T11:34:20Z")

</div>

By the way, what format is the output of this function?

> msg.image.getPixelColor

I have tried multiple website colour tools but so far no-one shows same colour that I seen in real picture?

Also If I click colour code, it it changes from this **0xf100eff** to this **252710655** , are they same?

---

<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:** [17 March 2021 13:44 UTC](https://discourse.nodered.org/t/can-read-photo-in-but-not-process/42639/10 "2021-03-17T13:44:42Z")

</div>

> [@fugit185](#):
>
> Also If I click colour code, it it changes from this **0xf100eff** to this **252710655** , are they same?

Yes.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/8/389e82a1743bb46748080efd795f06f7c90de311.png)

> [@fugit185](#):
>
> By the way, what format is the output of this function?
> 
> > msg.image.getPixelColor

From `jimp` docs...  
`image.getPixelColor(x, y); // returns the colour of that pixel e.g. 0xFFFFFFFF`

It doesnt state which way around it is but I suspect either AARRGGBB or RRGGBBAA

So your value **252710655** is same as **0xf100eff** is same as **#0f100eff**

So ...

- if it is AARRGGBB then drop the alpha channel you get #100eff ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/9/e9c9b5775062574b6a288cb7911502f131f90461.png)
- if it is RRGGBBAA then drop the alpha channel you get #0f100e ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/9/690f993797c06b3a19e09a9a2547405c2ac1cd0a.png)

---

<div class="post-metadata">

**Author:** ![fugit185](https://avatars.discourse-cdn.com/v4/letter/f/a87d85/32.png) [@fugit185](https://discourse.nodered.org/u/fugit185)\
**Post date:** [17 March 2021 17:18 UTC](https://discourse.nodered.org/t/can-read-photo-in-but-not-process/42639/11 "2021-03-17T17:18:51Z")

</div>

> [@Steve-Mcl](#):
>
> RRGGBBAA

Confirm that it is

> RRGGBBAA

---

<div class="post-metadata">

**Author:** ![fugit185](https://avatars.discourse-cdn.com/v4/letter/f/a87d85/32.png) [@fugit185](https://discourse.nodered.org/u/fugit185)\
**Post date:** [17 March 2021 17:19 UTC](https://discourse.nodered.org/t/can-read-photo-in-but-not-process/42639/12 "2021-03-17T17:19:38Z")

</div>

Thank you very much for fast responses and 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:** [31 March 2021 17:19 UTC](https://discourse.nodered.org/t/can-read-photo-in-but-not-process/42639/13 "2021-03-31T17:19:43Z")

</div>

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