# -*- coding: utf-8 -*-
"""
Python Version: 3.5
Created on Fri May 12 13:33:35 2017
E-mail: Eric2014_Lv@sjtu.edu.cn
@author: DidiLv
"""
from scipy.misc import imread, imsave, imresize
# Read an JPEG image into a numpy array
img = imread('Desktop\cat.jpg')
print(img.dtype, img.shape) # Prints "uint8 (400, 248, 3)"
# We can tint the image by scaling each of the color channels
# by a different scalar constant. The image has shape (400, 248, 3);
# we multiply it by the array [1, 0.95, 0.9] of shape (3,);
# numpy broadcasting means that this leaves the red channel unchanged,
# and multiplies the green and blue channels by 0.95 and 0.9
# respectively.
img_tinted = img * [1, 0.95, 0.9]
# Resize the tinted image to be 300 by 300 pixels.
img_tinted = imresize(img_tinted, (300, 300))
# Write the tinted image back to disk
imsave('Desktop\cat_tinted.jpg', img_tinted)
图像样子: