there is no pattern.

A friend asked me to help her make a video, which was supposed to look like this:

A white square, then one black pixel appears, then another adjoining one, another one; repeat with white pixels as soon as the square’s black. Randomize, goto 10. A simple algorithm, a quick PHP script that would output a series of tiny PNGs. But as soon as I tried to convert the dozens of 5×5px images to a movie (picking the lossless FFV1 codec as intermediate format), and scaling it up with a nearest-neighbor/point filter (up to DVD size), something weird happened: colors appeared from nowhere, even though I was explicitly converting to grayscale.

I ran some more scripts, and it turned out that the colors depend on the scale factor. Here’s an animated gif where every frame was converted with a different scale factor. (take a close look at the edges, they’re more blurred in the beginning, as the scale factor was higher. Ignore the GIF artifacts.

I wondered if there was a pattern, so I made a montage. The scale factor decreases left-ro-right, top-to-bottom.

I guess there is no pattern.

I tried other combinations of codecs, scale factors and colors, to no success. This “problem” turned out to be limited to

  • really small files
  • the nearest-neighbor/point filter
  • the FFV1 codec
  • an ancient version of MEncoder