loadmetadata#

loadmetadata(filename, load_all=False, die=True)[source]#

Read metadata from a saved image; currently only PNG and SVG are supported.

Only for use with images saved with sc.savefig(). Metadata retrieval for PDF is not currently supported. To load metadata saved with sc.metadata(), you can also use sc.loadjson() instead. To load metadata saved with sc.savearchive(), use sc.loadarchive() instead.

Parameters:
  • filename (str) – the name of the file to load the data from

  • load_all (bool) – whether to load all metadata available in an image (else, just load what was saved by Sciris)

  • die (bool) – whether to raise an exception if the metadata can’t be found

Example:

plt.plot([1,2,3], [4,2,6])
sc.savefig('example.png')
sc.loadmetadata('example.png')