Image to MakeCode Arcade image converter...again

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

A simple Python script that can accept images and :sparkles: multi-frame GIFs :sparkles: (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 web tool.

Easy to install* (all requirements are in the 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!

(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! :smiley: 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 :frowning:)

Enjoy!


* If you have at least Python 3.9 installed.

3 Likes

Will try this, thanks !

1 Like

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?

1 Like

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)

1 Like

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.

Ah ok so do I install these on my laptop ?

And what is pip

Hi @UnsignedArduino, great tool for convert gif!

I got this error, when converting a gif

And adding last 2 lines of following it passed

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

1 Like

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.

Can I still do this on chromebook ?

You could do it on repl.it maybe…

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

1 Like