Never been to DZone Snippets before? Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world Attributed to Sam Stephenson: 1 2 IO.read('image.png')[0x10..0x18].unpack('NN') 3 => [713, 54] Homegrown, GIF: 1 2 IO.read('image.gif')[6..10].unpack('SS') 3 => [130, 50] BMP: 1 2 d = IO.r