I have an image stored in an array as pixels, e.g.
[1,2,3,4] would correspond to pixel values of
1 2
3 4
in my image. I need to blow this image up, which means creating an array like this:
[1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 3, 3, 3, 4, 4, 4, 3, 3, 3, 4, 4, 4]
to make an image like this
1 1 1 2 2 2
1 1 1 2 2 2
1 1 1 2 2 2
3 3 3 4 4 4
3 3 3 4 4 4
3 3 3 4 4 4
I can make the arrays 2 dimensional if it makes things easier. FWIW, I'm using Java.
I am sure there is a simple solution, but I can't wrap my head around it at the moment. Usually the best thing to do is walk away for a bit and come back and it will seem obvious, but I want to get it done ASAP
[edit: N.B. The image is square. It's actually 11x11 pixels and I am blowing it up to 220x220 pixels. In fact I wonder if there is a built in method for blowing up images...]
[edit 2: there is
(Image.getScaledInstance())]