Improve robustness of cropping tool

This commmit makes sure that it is only tried to add images to the
GraphicsMagick image stack object, if it is not None.