Elementary image processing algorithms