some basic image manipulation functions