# Web app example: Image returned is incorrectly encoded

**URL:** <https://discuss.roboflow.com/t/web-app-example-image-returned-is-incorrectly-encoded/2967>\
**Category:** 🤝  Community Help\
**Created:** [August 21, 2023, 1:41am UTC](https://discuss.roboflow.com/t/web-app-example-image-returned-is-incorrectly-encoded/2967 "2023-08-21T01:41:14Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![abdullahmadawi](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/abdullahmadawi/32/2366_2.png) [@abdullahmadawi](https://discuss.roboflow.com/u/abdullahmadawi)\
**Post date:** [August 21, 2023, 1:41am UTC](https://discuss.roboflow.com/t/web-app-example-image-returned-is-incorrectly-encoded/2967/1 "2023-08-21T01:41:14Z")

</div>

I’ve recently come upon an issue using the Example Web app.

Using it to test some example imagery that I’ve previously used for the same Example Web app, the image returned with the inferences is incorrectly encoded. Instead of being returned something like the middle image I get the blue image.

 ![encodeErrorQuestion](https://canada1.discourse-cdn.com/flex029/uploads/roboflow1/original/2X/c/c61f84169d9aaf4756ad21dc26750804b2eda5b4.jpeg)

I’ve tested the Example web app with a different model and image and the issue persists.

I’m quite a beginner so I’m not entirely sure how to fix this.

- \*\*Project Type:_Object detection_
- \*\*Operating System & Browser:_Windows/ Google Chrome_
- **Project Universe Link or Workspace/Project ID:**

---

<div class="post-metadata">

**Author:** ![leo](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/leo/32/2228_2.png) [@leo](https://discuss.roboflow.com/u/leo)\
**Post date:** [August 24, 2023, 5:11am UTC](https://discuss.roboflow.com/t/web-app-example-image-returned-is-incorrectly-encoded/2967/2 "2023-08-24T05:11:31Z")

</div>

Hi @abdullahmadawi

That’s an interesting issue. I have several questions to clarify your issue.

Did this happen when the API drew boxes around the images? Are you using our CodePen? If so, can you link to it?

Also, please share your project’s Universe link or workspace/project IDs.

---

<div class="post-metadata">

**Author:** ![abdullahmadawi](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/abdullahmadawi/32/2366_2.png) [@abdullahmadawi](https://discuss.roboflow.com/u/abdullahmadawi)\
**Post date:** [August 24, 2023, 5:35am UTC](https://discuss.roboflow.com/t/web-app-example-image-returned-is-incorrectly-encoded/2967/3 "2023-08-24T05:35:07Z")

</div>

Hi,

Here is a link to the example CodePen by the team at Roboflow. I’ve tried the app with different file formats and band visualisations (RGB and IR), both of which are returned with a ‘blue tint’. My guess is that the colour channels are reversed in the image binary blob from the POST response and I’m not sure how to rearrange the order. [Project ID: treedetection-hrs8w].

![Bowood_2ndSept2021ir_088_090](https://canada1.discourse-cdn.com/flex029/uploads/roboflow1/original/2X/4/4dc7f775f0831f1388108fec942dadfacc649107.png)

 ![Okota_Ortho_RGB_035_079](https://canada1.discourse-cdn.com/flex029/uploads/roboflow1/original/2X/0/0937318fc0b50037a78a7fa337bf626e191cd34d.jpeg)

---

<div class="post-metadata">

**Author:** ![leo](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/leo/32/2228_2.png) [@leo](https://discuss.roboflow.com/u/leo)\
**Post date:** [August 24, 2023, 10:01am UTC](https://discuss.roboflow.com/t/web-app-example-image-returned-is-incorrectly-encoded/2967/4 "2023-08-24T10:01:22Z")

</div>

Hi @abdullahmadawi

That’s certainly interesting. I was able to replicate your issue so I’ll take a look into it, but in the meantime, please revoke your API key since you posted it publicly. Your API key allows access to your account and therefore should never be posted publicly.

Edit: Also, what is the type/source of your images?

---

<div class="post-metadata">

**Author:** ![abdullahmadawi](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/abdullahmadawi/32/2366_2.png) [@abdullahmadawi](https://discuss.roboflow.com/u/abdullahmadawi)\
**Post date:** [August 24, 2023, 12:30pm UTC](https://discuss.roboflow.com/t/web-app-example-image-returned-is-incorrectly-encoded/2967/5 "2023-08-24T12:30:06Z")

</div>

Thanks, your assistance is very much appreciated. The example images are tiles (png) from a Uint8 tiff. I have also tried with images taken from a tablet (jpeg).

---

<div class="post-metadata">

**Author:** ![leo](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/leo/32/2228_2.png) [@leo](https://discuss.roboflow.com/u/leo)\
**Post date:** [August 29, 2023, 12:53pm UTC](https://discuss.roboflow.com/t/web-app-example-image-returned-is-incorrectly-encoded/2967/6 "2023-08-29T12:53:26Z")

</div>

Hi @abdullahmadawi

Does the issue occur when you upload the images through the Deploy tab in your project?

In the meantime, if you need the boxes drawn on your image, you could do it based on the JSON response from the inference result.

Also out of interest, what device are you taking the other image?

---

<div class="post-metadata">

**Author:** ![John\_Shepard](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/john_shepard/32/2760_2.png) [@John\_Shepard](https://discuss.roboflow.com/u/John_Shepard)\
**Post date:** [August 31, 2023, 2:44pm UTC](https://discuss.roboflow.com/t/web-app-example-image-returned-is-incorrectly-encoded/2967/7 "2023-08-31T14:44:00Z")

</div>

Have you solved this bug? Because I also experienced this problem, my image from request is rotated and in another color scale

---

<div class="post-metadata">

**Author:** ![abdullahmadawi](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/abdullahmadawi/32/2366_2.png) [@abdullahmadawi](https://discuss.roboflow.com/u/abdullahmadawi)\
**Post date:** [September 3, 2023, 9:51pm UTC](https://discuss.roboflow.com/t/web-app-example-image-returned-is-incorrectly-encoded/2967/8 "2023-09-03T21:51:32Z")

</div>

Hi,

The issue does not occur through that method.

Yes, I have implemented that as a temporary solution.

---

<div class="post-metadata">

**Author:** ![John\_Shepard](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/john_shepard/32/2760_2.png) [@John\_Shepard](https://discuss.roboflow.com/u/John_Shepard)\
**Post date:** [September 8, 2023, 9:17am UTC](https://discuss.roboflow.com/t/web-app-example-image-returned-is-incorrectly-encoded/2967/9 "2023-09-08T09:17:22Z")

</div>

@leo Are you working on fixing this bug?

---

<div class="post-metadata">

**Author:** ![leo](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/leo/32/2228_2.png) [@leo](https://discuss.roboflow.com/u/leo)\
**Post date:** [September 11, 2023, 4:01am UTC](https://discuss.roboflow.com/t/web-app-example-image-returned-is-incorrectly-encoded/2967/10 "2023-09-11T04:01:56Z")

</div>

Hi @John_Shepard

We are working on fixing this bug. In the meantime, you can use the alternative that was brought up before. Also, you can use [Supervision’s](https://github.com/roboflow/supervision) utilities to draw your annotations onto images.
