Make ImageMagick optional & various file improvements