add function to scale images
improve comment style