scikit-image基本使用-打开、显示和保存图像文件

先看看打开、显示和保存图像文件

 from skimage.io import imread ,imshow ,imsave
 
img= imread('kdfu2.png', as_grey = True)#as_grey 是打开为灰度图像
imshow(img)

以灰度图像加载:scikit-image基本使用-打开、显示和保存图像文件

以原图像加载:

scikit-image基本使用-打开、显示和保存图像文件

保存图像:

imsave('xxx.png',img)

imsave支持 eps, pdf, pgf, png, ps, raw, rgba, svg, svgz格式,如果不是这些格式,比如使用了jpg格式,就会报异常:

ValueError: Format "jpg" is not supported.
Supported formats: eps, pdf, pgf, png, ps, raw, rgba, svg, svgz.

你可能感兴趣的:(scikit-image基本使用-打开、显示和保存图像文件)