When python mimetype fails(files without extension), fallback to libmagic to determine mimetype based on magic header. Added some extra helper methods in utilities, the image analyze now returns main layer as subname instead of the filename.