Click the button at top left to create a photomosaic made up of tiles from a gallery of photographic images.
Colour Bitwise Operations
On a computer images are made up of pixels. Each one is a solid block of colour. Computer based images are all made up of this individual building blocks.
- The photographic mosaic technique requires making a large image from a number of smaller images. These images are the tiles of the photomosaic, and they all need to have their average colour values calculated and stored, by adding up the colour values for all the individual pixels, then dividing the total by the number of pixels in the image to get the average colour value for the overall image.
- A large picture is divided into rectangular sections, with a computer algorithm, which goes through the tiles taking one pixel at a time and finding one of approximately the same overall colour, so as to match the colours of each section with tiles of appropriate average colour. The right-shift (>>) bitwise operator plays an important role in the colour representation. A colour can be represented by a 32-bit integer; with each colour component using a specific number of bits - eight bits in the default colour model (RGBA). For example, the pure green colour A=255, R=0, G=255, B=0 is created by using the right-shift operator to set the bits for each colour component and then the colour components are combined to represent the final colour.
- The trick as in this example is for there to be a cognitive relationship between the large image and set of smaller images.