Move image_write_read_test helper function to .cc file.
am: f1ddc20f37

Change-Id: I588969c4df8d3cc54adca407978f309f9c0e41fd