add some raw image manipulation functions