> For the complete documentation index, see [llms.txt](https://trizen.gitbook.io/sidef-lang/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trizen.gitbook.io/sidef-lang/programming_tasks/m/munching_squares.md).

# Munching squares

```ruby
require('Imager')

var img = %O<Imager>.new(xsize => 256, ysize => 256)

for y=^256, x=^256 {
    var rgb = [(255 - x - y).abs, (255-x)^y, x^(255-y)]
    img.setpixel(x => x, y => y, color => rgb)
}

img.write(file => 'xor.png')
```

[Output image](https://github.com/trizen/rc/blob/master/img/munching-squares-sidef.png)
