11
\$\begingroup\$

Last year, there was a very popular challenge to create an image containing every 24-bit RGB colour.

My challenge is to create a smooth animation (24 frames/s say), where the colour of every pixel of every frame is unique. I will also allow duplication of colours as long as every colour appears the same number of times (greater than 0), since otherwise the animation will have to be short, or the frames small.

I have produced some examples here, based on the winning solution to the 2d version. Unfortunately, it seems you can't embed videos, so links will have to do.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Someone already did an animation in this answer from the linked question. I'm not sure if it meets the criteria, though. \$\endgroup\$
    – mbomb007
    Commented Sep 11, 2015 at 16:50
  • 1
    \$\begingroup\$ Bit more technical specs would be nice. What does "create" mean? Render a video to disc? Display a realtime animation? \$\endgroup\$
    – user42643
    Commented Sep 12, 2015 at 16:14
  • \$\begingroup\$ You could use a gif... \$\endgroup\$
    – wizzwizz4
    Commented Dec 21, 2015 at 19:21
  • 1
    \$\begingroup\$ @wizzwizz4 a GIF cannot hold more than 256 colors; so you can make a 16x16 image with different colors for every pixel - and have no room left for animation. \$\endgroup\$
    – Titus
    Commented Sep 22, 2016 at 10:38

2 Answers 2

4
\$\begingroup\$

Mathematica

This is a straightforward implementation with each rgb colour occupying an intersection in a 256 by 256 by 256 unit grid.

The jerkiness seems to be an artefact of the video, not an error in the data, which should be exact.

red values increase downwards, green values increase rightwards, and blue values increase by frame.

Perhaps I'll jumble things up later.

f@b_ := Image@Table[{r, g, b}/255, {r, 0, 255}, {g, 0, 255}]
Export["c.mov", Table[f@b, {b, 0, 255}]]

QuickTime clip

\$\endgroup\$
3
  • \$\begingroup\$ This is puzzling. It works for me and the permissions are set for anyone to access it. Are you able to play other videos at vimeo.com ? \$\endgroup\$
    – DavidC
    Commented Sep 12, 2015 at 19:12
  • \$\begingroup\$ It does work now, for some reason. \$\endgroup\$
    – Fatalize
    Commented Sep 12, 2015 at 19:15
  • \$\begingroup\$ glad to hear it. \$\endgroup\$
    – DavidC
    Commented Sep 12, 2015 at 19:15
0
\$\begingroup\$

PHP (+ HTML) + JavaScript

Part 1
generate 256 images with distinct red values from 0 to 255;
green value=row index, blue value=column index

for($r=$h=256;$r--;){$i=imagecreatetruecolor($g=$h,$h);for(;$g--;)for($b=$h;$b--;)imagesetpixel($i,$g,$b,imagecolorallocate($i,$r,$g,$b));imagepng($i,"$r.png");imagedestroy($i);}

Note: Depending on Your PHP implementation, this may throw an internal server error.
If it does, take the lowest number of the images that already have been created, insert <number>, after $r= and run again.

Part 2
loop through these images from 0 to 255 and back (0 and 255 taking 2 frames each)

<img><script>r=d=0;setInterval(()=>{document.images[0].src=r+".png",(d?!r--:(++r)>=256)?r-=(d=!d)?1:-1:r},40);</script>
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.