# Image to MakeCode Arcade image converter...again

**URL:** https://forum.makecode.com/t/image-to-makecode-arcade-image-converter-again/12367
**Category:** Show & Tell
**Tags:** art, graphics-and-math
**Created:** [February 25, 2022, 1:58am UTC](https://forum.makecode.com/t/image-to-makecode-arcade-image-converter-again/12367 "2022-02-25T01:58:35Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)
#### Post date: [February 25, 2022, 1:58am UTC](https://forum.makecode.com/t/image-to-makecode-arcade-image-converter-again/12367/1 "2022-02-25T01:58:35Z")

</div>

Introducing _another_ image-to-MakeCode-Arcade image converter!

> **[GitHub - UnsignedArduino/Image-to-MakeCode-Arcade: Converts an image or a GIF...](https://github.com/UnsignedArduino/Image-to-MakeCode-Arcade)**
>
> Converts an image or a GIF to a MakeCode Arcade image / array! - GitHub - UnsignedArduino/Image-to-MakeCode-Arcade: Converts an image or a GIF to a MakeCode Arcade image / array!

A simple Python script that can accept images and ✨ multi-frame GIFs ✨ (that’s what makes it special) and turn them into a MakeCode Arcade image / image array!

The code to actually turn an image into a 16-color palette was based on @kristianpedersen’s [Convert-Image-to-MakeCode-Arcade-Sprite](https://github.com/kristianpedersen/Convert-Image-to-MakeCode-Arcade-Sprite) web tool.

Easy to install\* (all requirements are in the [`requirements.txt`](https://github.com/UnsignedArduino/Image-to-MakeCode-Arcade/blob/main/requirements.txt) file) and all contained in one (giant and ugly) script! Python and command-line knowledge is highly recommended to use this tool. Should be self-explanatory - run with `-h` to view the help.

When you convert a single image, you can copy and paste the entire image and paste it in the image editor. But for animations, you must go to text mode and paste in the array.

And here’s a simple program to display a soundless video with MakeCode Arcade - beware that it contains over 195k lines! It’s a 3-minute video that has over 2k frames at 10FPS - it took 10 minutes to render!

> **[GIF-converter-showcase](https://unsignedarduino.github.io/GIF-converter-showcase/)**
>
> Showcases the image converter made!

(If you find the actual video I used and play it along it stays in sync so you can jam along to the audio as well! 😃 The play animation block will compensate for time lost!)

And here’s a smaller one that you can see in blocks: (unfortunately the animation block turned into an array block ☹)

> **[Geese GIF](https://arcade.makecode.com/71061-33263-45967-61966)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

Enjoy!

* * *

\* If you have at least Python 3.9 installed.

---

<div class="post-metadata">

### Author: ![frank\_schmidt](https://avatars.discourse-cdn.com/v4/letter/f/7993a0/32.png) [@frank\_schmidt](https://forum.makecode.com/u/frank_schmidt)
#### Post date: [February 25, 2022, 5:27pm UTC](https://forum.makecode.com/t/image-to-makecode-arcade-image-converter-again/12367/2 "2022-02-25T17:27:27Z")

</div>

Will try this, thanks !

---

<div class="post-metadata">

### Author: ![personalnote](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/personalnote/32/31359_2.png) [@personalnote](https://forum.makecode.com/u/personalnote)
#### Post date: [February 25, 2022, 5:28pm UTC](https://forum.makecode.com/t/image-to-makecode-arcade-image-converter-again/12367/3 "2022-02-25T17:28:01Z")

</div>

I’m sorry how do we use it tho? Do we install PYTHON and run it there, or is there a website like @kristianpedersen 's web tool?

---

<div class="post-metadata">

### Author: ![Segatendo](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@Segatendo](https://forum.makecode.com/u/Segatendo)
#### Post date: [February 25, 2022, 5:28pm UTC](https://forum.makecode.com/t/image-to-makecode-arcade-image-converter-again/12367/4 "2022-02-25T17:28:32Z")

</div>

how exactly do you use this, everytime i click it it takes me to the github code and honestly i dont understand github stuff (and by the way your two gifs especially the first,are AMAZING)

---

<div class="post-metadata">

### Author: ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)
#### Post date: [February 25, 2022, 9:38pm UTC](https://forum.makecode.com/t/image-to-makecode-arcade-image-converter-again/12367/5 "2022-02-25T21:38:58Z")

</div>

It is unfortunately not a website, you must install python 3.9 or newer and download and run the script. Before running you also need to install the requirements with pip.

---

<div class="post-metadata">

### Author: ![Segatendo](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@Segatendo](https://forum.makecode.com/u/Segatendo)
#### Post date: [February 28, 2022, 4:20pm UTC](https://forum.makecode.com/t/image-to-makecode-arcade-image-converter-again/12367/6 "2022-02-28T16:20:37Z")

</div>

Ah ok so do I install these on my laptop ?

---

<div class="post-metadata">

### Author: ![Segatendo](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@Segatendo](https://forum.makecode.com/u/Segatendo)
#### Post date: [February 28, 2022, 4:21pm UTC](https://forum.makecode.com/t/image-to-makecode-arcade-image-converter-again/12367/7 "2022-02-28T16:21:08Z")

</div>

And what is pip

---

<div class="post-metadata">

### Author: ![AqeeAqee](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/aqeeaqee/32/5424_2.png) [@AqeeAqee](https://forum.makecode.com/u/AqeeAqee)
#### Post date: [February 28, 2022, 7:35pm UTC](https://forum.makecode.com/t/image-to-makecode-arcade-image-converter-again/12367/8 "2022-02-28T19:35:58Z")

</div>

Hi @UnsignedArduino, great tool for convert gif!

I got this error, when converting a gif

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/0/0891a86bd3527d0fb96d578cb72c79aa8667b7eb.png)

And adding last 2 lines of following it passed

```auto
                if isinstance(pixel, int):
                    pixel_color = index_to_color[pixel]
                elif len(pixel) > 3:
                    pixel_color = pixel[:-1] # Skip alpha
                else:
                    pixel_color = pixel

```

---

<div class="post-metadata">

### Author: ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)
#### Post date: [February 28, 2022, 8:25pm UTC](https://forum.makecode.com/t/image-to-makecode-arcade-image-converter-again/12367/9 "2022-02-28T20:25:12Z")

</div>

To install on your laptop, install Python 3.9 (or newer) to your computer. Then download the script to your computer. Then use `pip` (the program is usually installed when you install Python) to install the dependencies in `requirements.txt` with `pip install -r requirements.txt`. (Make sure you `cd` to the directory where you downloaded the files before running the above command) Then you can run the script with `python main.py`. You may want to run with `-`h (`python main.py -h`) to print the help.

---

<div class="post-metadata">

### Author: ![Segatendo](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@Segatendo](https://forum.makecode.com/u/Segatendo)
#### Post date: [March 1, 2022, 6:16pm UTC](https://forum.makecode.com/t/image-to-makecode-arcade-image-converter-again/12367/10 "2022-03-01T18:16:37Z")

</div>

Can I still do this on chromebook ?

---

<div class="post-metadata">

### Author: ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)
#### Post date: [March 1, 2022, 10:23pm UTC](https://forum.makecode.com/t/image-to-makecode-arcade-image-converter-again/12367/11 "2022-03-01T22:23:13Z")

</div>

You could do it on repl.it maybe…

---

<div class="post-metadata">

### Author: ![Segatendo](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@Segatendo](https://forum.makecode.com/u/Segatendo)
#### Post date: [March 2, 2022, 4:06pm UTC](https://forum.makecode.com/t/image-to-makecode-arcade-image-converter-again/12367/12 "2022-03-02T16:06:36Z")

</div>

Ah ok thanks I’ll try and see if that works

---

<div class="post-metadata">

### Author: ![Unique](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unique/32/32724_2.png) [@Unique](https://forum.makecode.com/u/Unique)
#### Post date: [July 15, 2022, 4:35pm UTC](https://forum.makecode.com/t/image-to-makecode-arcade-image-converter-again/12367/13 "2022-07-15T16:35:58Z")

</div>

@UnsignedArduino I keep running into this little error. Any solutions for this, I’m not very familiar with Python.  
 ![Screen Shot 2022-07-14 at 11.24.18 PM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/a/a8c5c971dc77ca569f8041daa10dbdefcb092010.png)

---

<div class="post-metadata">

### Author: ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)
#### Post date: [July 18, 2022, 4:02pm UTC](https://forum.makecode.com/t/image-to-makecode-arcade-image-converter-again/12367/14 "2022-07-18T16:02:05Z")

</div>

Hmmm…wonder what I meant to type there lol. You should be able to just delete that line, it’s just for debugging.

---

<div class="post-metadata">

### Author: ![Unique](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unique/32/32724_2.png) [@Unique](https://forum.makecode.com/u/Unique)
#### Post date: [July 18, 2022, 4:38pm UTC](https://forum.makecode.com/t/image-to-makecode-arcade-image-converter-again/12367/15 "2022-07-18T16:38:26Z")

</div>

I guess Python doesn’t like me today. This is a little confusing.

 ![Screen Shot 2022-07-18 at 12.24.44 PM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/7/7bacce3d92160b9e3e212d6547232d6044934558.png)

---

<div class="post-metadata">

### Author: ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)
#### Post date: [July 20, 2022, 5:18pm UTC](https://forum.makecode.com/t/image-to-makecode-arcade-image-converter-again/12367/16 "2022-07-20T17:18:06Z")

</div>

That’s really confusing, as it’s defined several lines up before. Try recopying the contents of [`main.py`](https://github.com/UnsignedArduino/Image-to-MakeCode-Arcade/blob/main/main.py) from the repo into that file.

---

<div class="post-metadata">

### Author: ![Unique](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unique/32/32724_2.png) [@Unique](https://forum.makecode.com/u/Unique)
#### Post date: [July 20, 2022, 10:38pm UTC](https://forum.makecode.com/t/image-to-makecode-arcade-image-converter-again/12367/17 "2022-07-20T22:38:31Z")

</div>

Okay, some progress. Any idea how this happened?

 ![Screen Shot 2022-07-20 at 6.08.27 PM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/5/56bd123d6421cea480d125d8ad380715a95e41ae.png)

---

<div class="post-metadata">

### Author: ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)
#### Post date: [July 20, 2022, 11:38pm UTC](https://forum.makecode.com/t/image-to-makecode-arcade-image-converter-again/12367/18 "2022-07-20T23:38:28Z")

</div>

That’s very confusing! Can you send me the image/GIF you are trying to convert??? It might be faster to do it that way so I can debug it faster on my machine instead of telling you to do stuff.

---

<div class="post-metadata">

### Author: ![Unique](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unique/32/32724_2.png) [@Unique](https://forum.makecode.com/u/Unique)
#### Post date: [July 22, 2022, 9:55pm UTC](https://forum.makecode.com/t/image-to-makecode-arcade-image-converter-again/12367/19 "2022-07-22T21:55:05Z")

</div>

![0001-0050 (1)](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/5/51d12087c198c0dcf075ff6b11ce310e35645023.gif)

---

<div class="post-metadata">

### Author: ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)
#### Post date: [July 22, 2022, 11:21pm UTC](https://forum.makecode.com/t/image-to-makecode-arcade-image-converter-again/12367/20 "2022-07-22T23:21:59Z")

</div>

Ah I’ve figured it out! It was something I’ve copied and pasted a long time ago and never fixed it, now it should work! (recopy the script from GitHub)

Note that, the only way that it would happen is that you didn’t specify an output file with `-o`, so it will spam it to the console. Maybe you should specify one, so the whole command would look like this:

```nohighlight
py main.py -i "petpalace.gif" -o "petpalace.txt" -g

```

[Next page](https://forum.makecode.com/t/image-to-makecode-arcade-image-converter-again/12367.md?page=2)
