2016-04-14 11 views
1

Ich möchte eine numpy Matrix als .png Bild speichern, aber ich kann dies nicht mit der Matplotlib tun, da ich gerne seine ursprüngliche Größe behalten würde (was appelliert die Matplotlib nicht tun Sie es, da es die Skala und den weißen Hintergrund usw. hinzufügt). Weiß jemand, wie ich dieses Problem mit numpy oder dem PIL umgehen kann? DankKonvertieren einer Matrix in ein Bild in Python

+0

siehe 'fig.figimage' http://matplotlib.org/api/figure_api.html#matplotlib.figure.Figure.figimage – tacaswell

+0

http://stackoverflow.com/questions/9910388/matplotlib-plot-small-image -ohne-resampling/9915223 # 9915223 – tacaswell

+0

Siehe auch http://stackoverflow.com/questions/902761/saving-a-numpy-array-as-an-image –

Antwort

1

scipy Bibliothek Gelöst mit

Import scipy.misc

... (Code)

scipy.misc.imsave (Name, ein Array-Format)

oder

scipy.misc.imsave ('name.ext', array) Dabei steht ext für die Erweiterung und bestimmt somit das Format, in dem das Bild gespeichert wird.

Verwandte Themen