Better method of extracting images from canvas element for testing.