目錄
Matplotlib
Python讀入圖像文件
模塊
方法
功能
參數(Parameters)
返回值(Returns)
Python輸出圖像文件
模塊
方法
功能
參數(Parameters)
參考文章
?
Matplotlib is acomprehensive library for creating static, animated, and interactive visualizations in Python.(2021.4.14,摘自https://matplotlib.org/stable/index.html)
matplotlib.image
This image module supports basic image loading, rescaling and display operations.(2021.4.14,摘自https://matplotlib.org/stable/index.html)
python100例?matplotlib.image.imread(fname,format=None)
Read an image from a file into an array
fname:str or file-like
The image file to read: a filename, a URL, or a file-like object opened in read-binary mode.
Passiing a URL is deprecated. Please open the URL for reading and pass the result to Pillow, e.g. with PIL.Image.open(urllib.request.urlopen(url)).
python圖像增強,format: str, optional
The image file format assumed for reading the data if not given, the format is deduced from the filename. If nothing can be deduced, PNG is tried.
numpy.array
The image data. The returend array has shape
?
python處理文本文件?matplotlib.image
matplotlib.image.imsave(fname,arr,vmin=None,vmax=None,cmap=None,format=None,origin=None,dpi=100,*,metedata=None,pil_kwargs=None)
Save an array as an image file.
fname: str or path-like or file-like
A path or a file-like object to store the image in. if format is not set, then the output format is inferred from the extension of fname, if any, and from rcParams["savefig.format"](default:'png') otherwise. If format is set, it determines the output format.
怎么用python處理數據、arr:array-like
The image data. The shape can be one MxN(luminance), MxNx3(RGB) or MxNx4(RGBA).
vmin,vmax:float,optional
vimin and vmax set the color scaling for the image by fixing the values that map to the colormap color limits. If either vmin or vmax is None, that limit is determined form the arr min/max value.
cmap:str or Colormap, default rcParams["image.cmap"](default: 'viridis')
python作圖、A Colormap instance or registered colormap name. The colormap maps scalar data to colors. It is ignored for RGB(A) data.
format:str,optional
The file format, e.g. 'png','gif','svg',... The behavior when this is unset is documented under fname.
origin:{'upper','lower'},default: rcParams["image.origin"](default: 'upper')
Indicates whether the (0,0) index of the array is in the upper left of lower comer of the axes.
python 文件,dpi:float
The DPI to store in the metadata of the file. This does not affect the resolution of the output image. Depending on file format, this may be rounded to the nearest integer.
metadata:dict,optional
Metadata in the image file. The supported keys depend on the output format, see the documentation of the respective backends for more information.
pil_kwargs:dict,optional
python的輸入、Keyword arguments passed to PIL.Image.Image.save. If the 'pnginfo' key is present, it completely overrides metadata, including the default 'Software' key.
https://matplotlib.org/stable/api/image_api.html
?
?
?
版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。
工作时间:8:00-18:00
客服电话
电子邮件
admin@qq.com
扫码二维码
获取最新动态