updated diff image writing