I would recommend storing them in base64 format.
require 'base64'
ascii = Base64::encode64(binary)
binary = Base64::decode64(ascii)
You could do this in a filter of course. I just made a dummy attribute called "image_binary" which, upon setting, base64 encodes the data, and when reading base64 decodes it.
--Michael