added script to flatten image libraries
small changes, eg comments