Painting smaller dots

My previous fox and cupcakes paintings each have dots that are approximately 2mm x 2mm. That’s fine but you need to be at least, say, five metres away before you stop seeing the individual “pixels”. Not that there’s anything wrong with seeing the individual paint blobs – nowt wrong with pixels at all – but I also try to create paintings that have some photographic quality to them. So I decided I wanted to paint something with smaller dots.

The fox/cupcake paintings are basically a paint-by-numbers grid. This works provided the numbers are big enough to see (or to be printed). The cupcakes picture had 64 colours which meant each number was double digits, and when the text is very small it could be very hard to distinguish 25 from 26, for example, or 10 from 18. Although it’s barely noticable, many pixels ended up (very slightly) the wrong colour. So how to go smaller?

The fox painting was based on a grid of single alphanumeric digits, with no visually similar characters used (1 and I, 8 0 and O, 8 and B etc). This allowed me to represent more than 10 colours without needing to go into double digits, which would have meant making the text smaller, and therefore harder to read. But I wanted to make the dots /really/ small; too small for a printed number to be visible. I considered other means of encoding the data (e.g. colour) but that limits you to around 10 colours. Could you really easily distinguish a tiny blue dot from a tiny purple dot?

In the end I decided to with an “augmented reality” approach. A camera is pointed at a grid of tiny black dots. The video stream is displayed onscreen with a grid of green dots superimposed on top. This “overlay” tells me which dots to paint. There are two variations of this:

  • For relatively small pictures using relatively large dots (e.g. Super Mario), the software using computer vision algorithms (courtesy of the OpenCV library) to detect the four circular markers on each corner. The software then knows the location of the paper grid (the black toner dots) and can correctly align the virtual grid (green circles onscreen). I can then software-pan around the image without needing to move the camera.
  • For relatively large pictures with relatively small dots (e.g. stamp) we need a different approach. Tiny dots require the use of a macro lense (which gives you a round, distorted viewport of what the camera sees) and even so a large grid means you cannot see the entire grid at any given time (let alone the markers). If you are zoomed in somewhere in the middle of the grid you can’t easily tell where you are, so to ensure alignment we need to ensure that both grids have “anchor dots” – more on that later.

Here are some practice, studio and experimentation pics…

Early experimentation with painting tiny dots. If the grid dots are too black/big they will show through the paint. You can paint multiple layers but that’s laborious so instead I just use smaller greyer dots. You can see that I tried painting some orange and yellow dots away from the grid to see how they would appear.082

Super Mario 3, fox, tiger, stamp. The fox is a bit blobby, definitely an early work. Mario was done with relatively large blobs of paint. The stamp is shown here with a bit of a pursed lip due, I think, to a mistake in mixing up the colours. I’ve since corrected it, slightly..20180809_214732

Extreme close-up. You can see the white gaps between the grey blobs – those aren’t intentional; it’s always a challenge getting the blobs the right size. Too small and you get gaps. Too large and they overlap other blobs.20180512_131828

I experimented with using water drops to magnify the image, because I wasn’t quite happy with the image I was getting from the (1920 x 1080) camera. A higher-resolution camera would be nice but would my laptop be powerful enough to run it smoothly? A camera with a smaller field-of-vision would also have helped. In the end I used a tiny cheap macro lense. It provides “free” x2 magnification but also introduces lense distortion.

20180423_202809

By comparison, the size of my previous fox painting. You can squeeze approximately 48 “micro” dots inside each of these blobs: 008 (4)

The original set-up: the camera is underneath; the screen is therefore directly overhead the camera and the painting. But this makes it difficult to use the keyboard, or indeed the mouse, go to YouTube etc. In the end I decided the screen didn’t need to be over the painting, and it works just as well with the camera to my right and the laptop orientated normally.001 (4)

Another experimental idea: use a side camera to help me overcome the depth perception challenge of trying to dab paint using a single overhead camera. You can see the cardboard spherical hole where it would sit. I gave up on this because using two cameras reduced the framerate onscreen.015

The laptop no longer upside down, but with the camera still underneath. Also visible: the palette for a horse painting I never got around to starting for various reasons.007

Fox

Original bitmap (left) and painting (right), plus the palette.009 (3)

Close up, looking very blobby. The numbers refer to the resolution (30 pixels wide x 30 pixels high) and the dot resolution (“7”, just the internal scaling factor used in one of my tools).018 (2)

Tiger

Original and painting.033

Work in progress1366x768

Magnified close up through a small macro lense held in place by a wooden peg. The lense is approximately 1cm from the camera; later on I decided it worked better with the macro lense as close to the camera lense as possible.Screenshot from 2018-04-30 18-10-03

Mario

Palette, painting and original004

Close up006

 

Posted in flashasm, pixel art | 1 Comment

Anamorphic checkerboard shoes

Now for something that isn’t really pixel art, but does still use a grid.

I took some old shoes and painted them white. Then I stretched some rubber bands across some wooden frames and used a light to cast vertical shadow lines across the shoes.This allowed me to trace the shadows using a pencil. I rotated the frame ninety degrees and repeated the process with horizontal shadow lines. The result was a grid, but only if viewed from a certain angle. Then I painted the squares black and white, with a random magenta square.

003 (2)

005 _

Correct angle:025

Incorrect angles:shoes2shoes3

 

Posted in flashasm | Leave a comment

Pixel fox acrylic painting

I actually did this in May/June 2016 but I’ve only just gotten around to adding it to my site. This took 130 hours.

092093

139.JPG

It’s similar in execution to my most recent cupcakes painting – start with a photograph, do some magic, print a grid of numbers, paint the grid. The difference lies in the palette.

The cupcakes painting has a palette of 64 colours which were chosen using an algorithm known as colour quantization. This involves analysing the original photograph and generating a palette that best represent its full range of colours. I had to precisely blend each and every colour; difficult but ultimately resulting in a more realistic appearance (hopefully). Let’s call this a custom palette approach.

For this fox painting, I used an algorithm that generates a picture using a specific list of colours. In other words, telling it that I have leaf green, raw umber, light blue etc and asking it to do the best it can with those paints. Let’s call this a fixed palette approach. It’s a lot easier than the custom palette method because it doesn’t involve the tedious business of having to very precisely mix up colours, worry about having them dry up before you’re finished with etc. Instead, you can just apply the paint directly from the tube.

006 - CopyIn a nutshell: paint a small blob of every colour onto a piece of paper, photograph it, extract the RGB values, feed into the algorithm. I didn’t photograph the colours properly so the end result isn’t quite right. It’s very noticable if you compare it with the original photograph, but I think if you’ve never seen the original, you’d be none the wiser.

colourcomparison

Close up, work in progress..

012018 (2)024 (2)026 (2)

Work in progress…046

The grid uses numbers and letters; this allowed me to have more than 10 different colours without having to use double digits (which would require smaller text, making it harder to read). Although I tried to ensure that all characters looked visually distinctive, I didn’t always get it right – e.g. X and K look quite similar here.

064

Artist’s studio070

More close-ups088093

 

Posted in flashasm, pixel art | Leave a comment

81920 pixels of 64-colour cupcake goodness

Previous attempt

Last year I painted some “pixel art” cupcakes.

Full size cupcakes 002

I was reasonably satisfied with the result, but felt I could do better:

  • I had accidentally stretched the image vertically (compare the painting on the left with the original on the right)
  • I slightly regretted that I had chosen to focus on the colourful frosting instead of the relatively empty space at the top or the softer shades around the paper cases.
  • The “art room” palette (i.e. whatever sixteen or so paint colours happen to be available at the time) was a little inadequate – note the noisiness of the blue frosting layers caused by not having any pale blue paint, or the “hundreds and thousands” RGB noise which attempt to render the blurry paper cases in the background.
    • I might have been able to get away with this if it was a sufficiently high resolution (and accordingly if the picture was viewed from a distance).

It was time for an alternative approach – create a custom palette suited to the picture.

More colours, more pixels

The original photograph is 640 pixels by 740 pixels, and contains almost 125,000 different colours. To render a painting with that resolution and palette would take me approximately 400 years, assuming I work 60 hours a week and 52 weeks a year, and that’s assuming I have the visual acuity, patience and general ability to distinguish between and correctly mix almost identical colours.

I therefore needed to reduce the resolution and palette. Too low and it would not be much of an improvement over the first cupcake picture. Too high and it would take too long to finish. The pixels themselves need to be “the right size” – big pixels require the viewer to be some distance from the painting, small pixels would make it difficult to read the numbers on the paper or to paint the pixels precisely without overflowing onto neighbouring pixels.

I settled on a resolution of 256 x 320, slightly arbitrarily (it’s the screen resolution of “mode 13” in RISC OS, which I had used for some of my pixel art software) and to use roughly the same size pixels as before (2mm x 2mm). This would span across four pieces of A3 and result in a painting that is almost A1 sized.

The next question – how many colours to use? Anything less than around 20 was out of the question (because that would only be a tiny improvement over the first cupcake painting). But too many colours could be impractical:

  • The more colours in your palette, the more similar they will be.
    • The more similar they are, the more important is to be precise when mixing those colours, otherwise you could (for example) end up with two different colours mixed identically. In which case, why bother having so many colours? More precision equals more time and frustration.
    • Real world variables like lighting, paint moisture, paint texture (flat vs bumpy) make it pointless trying to be too precise.
    • The colour swatches (see below) are printed using software, files, printers and paper that are all capable of introducing their own variations and errors. (Especially if you opt to save money by not splashing out on expensive photographic paper).
    • Some colours/hues/whatever are harder to tell apart than others (very light or very dark colours are especially tricky), and a photo editing program is unlikely to optimize for this.
  • You get “diminishing returns” with too many colours – 200 colours isn’t noticably better than 100 colours.
  • The greater the number of colours, the more digits needed to represent them all. The more digits you use, the smaller they need to be. If you want to use more than 10 colours you’ll need double digits, more than 100 colours and you’ll need triple digits etc.
    • You can use non-numeric digits to extend the range (e.g. hexadecimal to give you 16 colours or alphanumeric to give you 36 colours) but it can be tricky distinguishing between 8 and B, 1 and I, 0 and 0 etc. Even telling 5 and 6 apart can be tricky when the numbers are tiny and the paper is worn
  • Economy of action – if you have 60,000 pixels and 32 colours, that works out to be approximately 1875 pixels per colour, so having spent an hour or so very carefully mixing a particular colour, there is at least the sense that you are “getting your money’s worth”. If you are mixing up 200 colours then you’re only getting approximately 300 pixels from each batch.
    • Why did I say 60,000 and not 81920?  Although the resolution of the picture is 256 x 320 (81920 pixels), approximately one quarter is taken up by a very pale blue background.

 

Three random links:

 

After fiddling around with The GIMP I settled on the “round” number of 64 colours. This produced an image with a few odd pixels, which I guess are technically correct (with regards to maintaining the RGB balance of the Floid Steinberg dithering algorithm?) but aesthetically dubious. For example, the scattered pink pixels in the background, or the dark pixels to the left of the frosting:

 

oddpixels2

I somewhat arbitrarily tweaked some of these odd pixels at the editing-on-computer stage and others when I was actually painting (either by omitting them or by painting them “correctly” and then changing my mind and painting over them with more aesthetically pleasing colours). In some cases, I just went along with the suggested colours (even if they looked a bit wrong) and painted them anyway.

Some “odd” pixels are merely artifacts of the actual objects, like the green and pink pixels amongst the brown, that are caused by the imprint of the frilly paper cases against the cupcake:

odd pixels 1

 

Preparation

The previous cupcake painting simply consisted of a piece of paper with a grid of numbers with each number corresponding to a named paint colour (e.g. 7 = “burnt sienna”). There was no need to create my own custom colours, and as most colours was found in abundance all over the canvas there was no need for any planning or strategy – just dip the brush in the paint and start anywhere.

However, this project required two additional guides – maps and swatches.

Maps show where each colour appears within the canvas. For example, this is the map for colour 33 – a slightly orangey pink. Two maps per A4 page. I would then manually crease each map into four segments – remember that the entire photograph is four A3 pages.

011

A few colours were found in very tight clusters (typically around a particular colour of frosting) and these might be reasonably possible to paint without a map. However, most colours were scattered around all over the canvas (a cluster here, a few pixels there) and for this reason the maps were essential.

The somewhat tatty piece of paper shown below contains swatches for each of the 64 colours. By dabbing a small amount of paint (and then allowing it to dry, which causes it to darken very slightly) I could check whether my paint matches the swatch. When it does – and it often took me on average ninety minutes per colour to get satisfactorily close – it was time to start painting the pixels.

“Every colour tells a story” – well, I could probably comment on about twenty individual colours, but it wouldn’t be tremendously interesting to read. Some were harder to mix than others. A few were frustrating. A couple were virtually impossible without the right paint – trying to mix some pinky/purpley colours just by mixing red and blue just didn’t bloody work (you need a paint with a “red” tone or something). One or two colours were mixed virtually identically to the swatch (for sake of argument let’s call that “100%”); most were very close (“85%”), some were reasonable (“70%”) and a few were done quite shoddily (“60%” or below), possibly because I was still finding my feet with the colour mixing.

It was only near the very end that I realised the importance of inspecting the swatches under natural daylight instead of artificial lighting.

014

As a rough rule of thumb, the more blobs of paint covering each swatch, the harder it was to match accurately. Sometimes I ran out of space (having painted over the entire swatch) and had to try to match the paints left between the blobs – tricky.

Each swatch was accompanied by a triplet of red/green/blue values because I thought this might prove useful. In practice, it rarely did.

015

Colours 12, 13 and 15 were tricky. Sometimes blues can have a tiny element of purple in them – but contrary to my naive understanding of colour, merely adding red just doesn’t work. Similarly with colour 48 (funky pink).

Colour 47 was a right awkward sod as my margin comment will testify.

I now have a deeper appreciation for those paint-mixing contraptions at DIY stores, and the eyedropper “colour selector” tool from Photoshop/GIMP/etc.

 

Painting

The actual painting of the pixels was easier than the colour mixing.

The first several colours I painted were not really done very well. In the picture below you can see several spikey blobs (especially in the red cherry) and some flakiness in the orange area due to (if I remember rightly) dry paint. Tall spikes are a problem because they cause shadows if the lighting is not directly in front of the painting. I didn’t worry about spikey pixels at the beginning – if anything, I preferred the texture and character they added to the painting – but later changed my mind.

016

Another mistake I made early on was painting pixels as small round blobs rather than squares. (Screen pixels might not be square, but mine certainly are). This results in small white corners where the paper shows through, which can be noticable around dark colours. You might be able to spot a few in the picture below:017

One solution to the “white corner problem” is to carefully mix up that colour again and paint over each pixel, this time around ensuring that the entire square is covered (and also being careful not to accidentally cover any adjacent pixels). This can be quite time consuming and error-prone if there are any similar colours nearby. A quicker approach is to carefully dab some watered down pale paint in the corners (e.g. pale orange for orange pixels, pale green for green pixels etc), thus changing the white corners into off-white. Not perfect, but it takes the “edge” off the whiteness and is a lot quicker and easier than remixing various colours.

Another defect are pixels which were only painted with a thin layer, causing the number to show through the paint. This typically happens with pale colours like yellow, and can be avoided by placing blobs of paint rather than thin layers.

Towards the end of the painting I did a few tweaks, such as remixing and repainting a couple of colours (2 and 4, if I recall correctly) because the paper case in the background on the right hand side was a tiny bit too brown and dark. The result is 3% less magenta, 1% more yellow and 1% less black. Compare the very slight difference:

004 _ merged

Over 300 hours later…

I started in November 2015 and worked on it approximately eight hours a week for the first few months and about thirteen hours a week for the last few months, including a few six hour evenings.

The original photograph is a beautiful image, with gorgeous three dimensional cupcakes in the foreground, soft (and almost two dimensional) cupcakes in the background, and the detail of the green dotted paper cases.

My painting, by contrast, is a horrible mess! An imperfect, organic creation with blemishes and mistakes which makes the original even nicer in comparison. Its misdemeanours include…

  • Oddly coloured pixels caused by the algorithm
  • Flakey squares caused by dry paint
  • A streaky background – I should have used a thinner paint and a brush that didn’t keep shedding its bristles
  • Thinly painted pixels where the number can still be seen through the paint
  • Small pixels which had been painted as small blobby circles rather than large squares, thus creating small white corners around each pixel. This is prerty much harmless for light coloured pixels but creates visual noise around dark pixels.
    • Sometimes I cheated by filling in these white corners with the same paint as neighbouring pixels, but this causes a colour imbalance where the surrounding colour ‘overbears’ the inner colour
  • Inordinately spikey pixels (small blobs are fine but spikes cast shadows)
  • One or two places where I attempted to repaint an area but gave up because I couldn’t match the colour just right with the paints I had, thus leaving it with slight blemishes.
  • Downright incorrect colours – the numbers are very small and once the ink has been worn off by constant handling it can be impossible to distinguish between 5 and 6, for example.
  • Off colours – near the end of the project I had a few left-over pixels to paint, and these colours were not mixed to the usual high standard
  • Slightly off colours – at the beginning, some colours were not mixed to a decent standard; and even towards the end there were times when I ran out of time/patience and thought “sod it, this is good enough”
  • and if you look carefully you can see the seams where the four A3 pages have been carefully joined together.

Many of these imperfections cannot be seen unless you know exactly where to look and what to look for; many are so inconsequential that you might not find them even if you do know where to look, and virtually none of them can be seen if you stand a few feet away.

Original photograph shown for comparison:

003005007009

 

Studio / Development pictures

Having painted all 64 colours I should be finished – right? Nope, because there were around 100 unpainted pixels that had somehow got overlooked. So I then needed to spend several more hours figuring out which colours needed to be remixed. (I didn’t spend quite as much time mixing them this time, as I was only repainting a few pixels for each colour. But they still needed to be reasonably close).

014

 

So many colours..

051_

Trying to mix up an elusive shade of orange just right. (Note: the paint wasn’t actually that glossy; that’s just the lighting)12744402_10153549286276799_6831275579887579095_n

 

 

Close ups

004 (3)004 (5)005 (3)005 (5)006 (2)007010 (4)011 (3)013 (2)014 (2)014017 (2)021024 (2)025029

Thanks to Sprinkles Bakeries for giving me permission to paint her gorgeous cupcakes, the wonderful Lisa for her support and everyone from my art group.

 

 

 

Posted in flashasm, pixel art | Leave a comment

More incredibly slow rendering algorithms (cupcakes pixel art)

Introduction

This is a painting. It contains 20480 small squares (160 x 128) and took approximately 30 hours to paint.

Full size cupcakes

004 (3)

 

Previous attempt

In 2014 I decided to paint a bitmap of my face.

I compiled a list of every acrylic paint in our art group, then found a PDF from the manufacturer’s website and made a note of each colour’s RGB values. Then I knocked up a BBC Basic program to render the picture using the Floyd Steinberg dithering algorithm. The result is a grid of numbers (each number corresponding to a colour) which can then be copied into Word, printed, then enlarged onto A3 using a photocopier.

It’s essentially paint-by-numbers plus pointillism. Is it “pixel art”? Well, it’s art involving pixels, but I’m not colouring the pixels by hand (that’s done programmatically by the algorithm, using a photograph) and I’m not painting using a digital tool, so… possibly not.

006

I made a number of mistakes, which is why I gave up before finishing:

  • What you see is a quarter of the final result – I had bitten off more than I could chew.
  • I hadn’t spent enough time in Word tweaking the character spacing between each digit, and as a result each pixel was slightly rectangular. The end result would be a little distorted.
  • I wasn’t happy with the colours. I think part of the problem is that I should have painted each colour onto a piece of paper and then taken a photograph, rather than using a PDF colour sample swatch.
  • The source photograph was fuzzy and rubbish – it was taken in poor lighting using my iPad. I didn’t like painting the photo’s background (the yellow, white, blue, red etc pixels on the right hand side, behind my hair) because it was just noise.

 

Take two

I learnt from my mistakes and tried again:

  • Reduced the resolution from 320×256 to 160×128.
  • Made absolutely sure the Word document number grid was exactly square.
  • Painted all sixteen acrylic colours onto a piece of paper, photographed, and fed their RGB values into the program. These were slightly different to the colours I had from the PDF file.
  • Spent some time on Google Images looking for a colourful, high quality photograph – and found a beautiful one courtesy of Sprinkles Bakeries.

Doing a pixel painting like this is like getting a tattoo done – you want to make absolutely sure you really like the picture, because you’re going to be investing a lot of time and tears into it.

This is the preview picture. To emphasise the colourful bits I ended up cropping and stretching the original photograph. In retrospect it might not have been such a bad idea to include the cupcakes themselves, rather than focus exclusively on the frosting.

The blue pixels in the white background aren’t ideal but they are there because the background is actually a cyan off-white. The white pixels all over the image are quite noisy and contrast poorly with the darker colours (e.g. blue) but that’s not too bad.

The original “palette” consisted of sixteen colours, but one of them is not used at all in this painting – black.

cupcake4

I also made a small tweak to the algorithm, which resulted in a small improvement, by changing this:

dist = (red_dist + green_dist + blue_dist) / 3

to this:

dist = square_root( (red_dist * red_dist)
                  + (green_dist * green_dist)
                  + (blue_dist * blue_dist))

 

Painting

Painting small pixels requires a steady hand.

Some colours (e.g. white and lemon yellow) are transparent, which means the original number which still show through unless you obscure it completely with a blob of paint. This makes the painting very textured to the touch, but also means you have to be careful when painting next to these blobby pixels as it’s easy to accidentally smear the wrong colour of paint on them.

All fifteen colours in this painting’s “palette” are pure acrylic colours applied directly to the paper, without any blending, whitening etc.

Some close-ups (sorry for the photography quality):

019 020 (2) 021 022

The actual painting took approximately 30 hours, not including the time spent suffering from choice overload on Google Images, faffing around with The GIMP or tweaking dithering algorithms. I think I could have done it a little bit quicker if I was more methodical, e.g. doing the ‘flat’ colours before the ‘lumpy’ ones.

Someone had bet me £5 that I wouldn’t finish this painting before Christmas, on the basis that I gave up on the first one…

 

 

Posted in pixel art | 1 Comment