Submitted by Kamal Wickramanayake on February 11, 2008 - 08:28

While not common, in rare cases you may have an image in its raw pixel format (say in rgb565). It can even be a portion of video. If you ever come accross converting such raw data to say a png or jpeg image, ffmpeg can be used easily. See the following command:

ffmpeg -vcodec rawvideo -f rawvideo -pix_fmt rgb565 -s 1024x768 -i image.raw -f image2 -vcodec png image.png

 1024x768 is the geometry. image.raw is the file containing the image in rgb565 format. image.png is the new file to be written.