image file writing in linux