Ruby jpeg encoder and decoder