zoukankan      html  css  js  c++  java
  • 使用python生成iOS各规格icon

    使用python可以很方便的一次导出所需的各种大小icon,省时省力,美术只需要准备一个最大的icon就行了。

    #!/usr/bin/python
    # -*- coding: utf-8 -*-
    from PIL import Image
    infile = raw_input('Please enter the image path: ')
    outPath = raw_input('Please enter the export path: ')
    print('infile:' + infile)
    img = Image.open(infile)
    (w,h) = img.size
    print('originW:' + str(w) + ',originH:' + str(h))
    
    arr = [180,152,144,120,114,100,87,80,76,72,57,58,50,40,29]
    for index in arr:
    newW = index
    newH = h * newW / w
    outfile = outPath + '/'+ 'Icon-' + str(index) + '.png'
    out = img.resize((newW,newH),Image.ANTIALIAS) #resize image with high-quality
    out.save(outfile)
    print('output file ' + 'Icon-' + str(index) + '.png...')
    print('Export all ICONS finished...')

    保存成python文件就行了!

  • 相关阅读:
    JQuery判断checkbox是否选中-批量
    浮动跟随
    当天时间戳范围
    统计兼职人员打标签数量
    submit回车提交影响
    js 数组去除空值
    js循环
    ajax
    滚动条位置
    oc基础-set和get方法的使用
  • 原文地址:https://www.cnblogs.com/skyxu123/p/9543800.html
Copyright © 2011-2022 走看看