I'm trying to make a function that will take a few pictures and make a collage type thing for a background. I've been trying to use the HTML 5 <canvas>
but have had no luck. I have various images each being 16x16 pixels. When I tried to add them to the canvas, they became very "smooth" but I need them to be pixelated. They also appear larger than i would expect for something 16 pixels large. I have done research on this, but no results seem to be working. Should I keep using canvas for this or is there a better/easier way?
This is the JavaScript i used:
var bg = document.getElementById("background".getContext("2d");
var img1 = new Image();
var img2 = new Image();
//etc...
img5.onload = function(){
bg.drawImage(img1,0,0,16,16);
bg.drawImage(img2,0,16,16,16);
//etc...
}
img1.src="1.jpg";
img1.src="2.jpg";
//etc...
P.S. Im sure this code is horribly inefficient, but i will clean it up later.