Use r.raw for reading and avoid creating temporary files