日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python批量处理图片属性_python PIL 批量处理处理图片

發布時間:2024/1/8 python 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python批量处理图片属性_python PIL 批量处理处理图片 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

python PIL 批量處理處理圖片

客戶給一堆圖片要傳到后臺,圖片太大了,上百張圖用photoshop改太慢,就想到用python寫個簡單的批處理。功能簡單就是把原圖按比例縮小,代碼更簡單 20多行。

# -*- coding: cp936 -*-

import Image

import glob, os

#圖片批處理

def timage():

for files in glob.glob('D:\\1\\*.JPG'):

filepath,filename = os.path.split(files)

filterame,exts = os.path.splitext(filename)

#輸出路徑

opfile = r'D:\\22\\'

#判斷opfile是否存在,不存在則創建

if (os.path.isdir(opfile)==False):

os.mkdir(opfile)

im = Image.open(files)

w,h = im.size

#im_ss = im.resize((400,400))

#im_ss = im.convert('P')

im_ss = im.resize((int(w*0.12), int(h*0.12)))

im_ss.save(opfile+filterame+'.jpg')

if __name__=='__main__':

timage()

print '哈哈完蛋啦'

相關文檔:

今天看了序列類型相關的比較操作.

在python核心編程(2nd)一書中6.13.1章節中, 給出了列表比較的一個準則..

個人感覺還是不很完善:

如果掃描到兩個列表中當前比較元素是不可比較的, 那么返回什么??

我用的是python2.6....

對這個問題做了一些測試, 自己目前嘎絕當比較遇到上述情況時, 是使用兩個列表的內存地址值來比� ......

ZoundryDocument

Python skin is known for its color variations and for its elasticity; it is

the warmest leather of the season and ideal for the manufacture of many luxury

goods. Sometimes natural patterns can be hidden when they're done in black, but

the finish here has a bit of a shine to it ......

1. 事件驅動

一個事件及其回調的例子是鼠標移動。我們假設鼠標指針停在您GUI 程序的某處。如果鼠標被移到了程序的別處,一定是有什么東西引起了屏幕上指針的移動,從而表現這種位置的轉移。系統必須處理這些鼠標移動事件才能展現(并實現)鼠標在窗口上的移動。一旦您釋放了鼠標,就不再會有事件需要處 ......

二進制文件下載地址:

SinaGetBook

效果如圖:

代碼:

#!/usr/bin/env python

#coding=utf-8

#!/usr/bin/env python

#coding=utf-8

import traceback

import sys

import wx

import re

import urllib

import wx.richtext as rt

import wx.lib.buttonpanel as bp

import Casing

import Debug

def trace_back ......

總結

以上是生活随笔為你收集整理的python批量处理图片属性_python PIL 批量处理处理图片的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。