This tool is designed to help illustrate how computers can represent images using binary data.
It lets you generate bitmap pixel colour data from any image, that you can then load, display and manipulate in python or most other programming languages.
Instructions
Choose any image. Small ones are best as the size of the output bitmap data is limited to 32x32 pixels
Choose what type of data you want (black & white, greyscale or full colour). You can also generate an image to display on a BBC micro:bit
Copy and paste your bitmap data into your code and get experimenting!
Ideas and activities
Loading bitmap pixel colour data is a great way of practising working with data stored in 2d arrays.
Why not try to:
Create a python function that will load bitmap pixel data from a file into a 2d array
Create a python function that will invert black and white bitmap data (swap 0s and 1s)
Create a python function that flips an image upside down
Create a python function that flips an image left and right
Instructions
Choose an image to generate the bitmap data from
Or drag and drop an image below
Drag and drop an image here
Source image:
Input area
Target Size:
Note: sizes are limited to a max of 32x32
Image type
Threshold:
Preview
Python code
This python code is designed for create.withcode.uk and it contains both the pixel colour data and code necessary to display it as a bitmap image.
Bitmap data
This shows the colour data for each pixel of your image. You can copy and paste it into a text file and read it from most programming languages.