Python automatically generates iOS icons and pythonios

Source: Internet
Author: User

Python automatically generates iOS icons and pythonios

Use python to automatically generate iOS icons of various sizes (based on a 1024-inch image). The Code is as follows:

Import PIL. imageimgNames = [(), "icon-72.png"), (), "icon-40.png"), (80), "icon-40@2x.png"), (50 ), "icon-50.png"), (100,100), "icon-50@2x.png"), (60, 60), "icon-60.png"), (120,120), "icon-60@2x.png"), (180,180 ), "icon-60@3x.png"), (114,114), "icon-72.png"), (152,152), "icon-72@2x.png"), (), "icon-76@2x.png ), "icon-76.png"), (58,58), "icon-small@2x.png"), (29,29), "icon-small.png"), (57,57), "icon.png"), (114,114 ), icon@2x.png)] im = PIL. image. open ("1024.png") I = 0for I in range (len (imgNames )): IBD = imsize = imgNames [I] [0] # print sizename = imgNames [I] [1] # print name + type (name) imt_r = IBD. resize (size, PIL. image. LANCZOS) imt_r.save (name) I = I + 1


The mac built-in python environment (which may not contain the PIL library and needs to be downloaded) can be generated using terminal-related commands:

1. cd to the directory where the 1024 graph is located, save the above Code in the same directory as vi **. py

2. python **. py

3. Other dimension requirements can be freely modified in imgNames

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.