I recently listed to the song I'm a Textpert about texting while driving and one particular line in the song inspired this challenge.
I never stoop so low as to text photos / Instead I text the correct combo of ones and zeros
Now obviously, this would be an almost impossible thing to do in ones head and so you should help textperts world wide by coding a program to do the same thing.
Your job is to take the name of an image file with the dimensions
500x500 pixels and output the file as binary. You may also take an image as input, if you language supports it.
You may use image files with the extensions
Allow me to demonstrate how to convert an image into binary, for those who don't understand what I mean.
Take the first pixel in the file and retrieve its RGB value as 3 decimal numbers: R, G and B. Let's assume, for example, that the first pixel is
Convert each number into its 8-bit binary representation and concatenate into a single 24-bit number. For the example, this yields
Add this 24-bit number to the final output. Therefore, the final output should be
6000000 digits long and should consist of entirely
This is a code-golf so shortest code wins!