This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$dir = opendir("images"); | |
$dirname = dirname(__FILE__) . '\images'; | |
echo $dirname; | |
while(($file = readdir($dir)) !== false) { | |
if ($file!='.' and $file!='..') { | |
echo "filename: {$file}\n"; | |
$newFilename = substr_replace($file, 'jpg', -3, 3); | |
rename($dirname . "\\" . $file, $dirname . "\\" . $newFilename); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
# cxy @ 2014.10.28 | |
# 将此脚本与mask.png放在同一目录下,子目录'pic_origin'存放待剪裁的图片 | |
import os | |
from PIL import Image | |
def get_pic_list(dir_str): | |
lst = [] | |
for i in os.listdir(dir_str): |