Use Python to automatically generate iOS size specifications icon (based on a 1024-large image), the code is as follows:
Import PIL. Imageimgnames = [((72,72), "Icon-72.png"), ((40,40), "Icon-40.png"), ((80,80), "[email protected]"), ((50,50), " Icon-50.png "), ((100,100)," [email protected] "), ((60,60)," Icon-60.png "), ((120,120)," [email protected] "), ((180,180) , "[email protected]"), ((72,72), "Icon-72.png"), ((114,114), "[email protected]"), ((152,152), "[email protected]"), (( 76,76), "Icon-76.png"), ((58,58), "[email protected]"), ((29,29), "Icon-small.png"), ((57,57), "Icon.png"), ((114,114), "[Email protected]")]im = PIL. Image.open ("1024.png") i = 0for i in range (len (imgnames)): IMT = Imsize = imgnames[i][0] #print sizename = imgnames[i][1] #pr int Name+type (name) Imt_r = Imt.resize (Size,pil. Image.lanczos) Imt_r.save (name) i = i+1
Mac built-in Python environment (may not contain PIL library, need to download), using terminal-related commands to generate:
1.CD to 1024 in the directory, the above code in the same directory with VI saved as **.py
2.python **.py can be
3. Other size requirements, can be freely modified in the Imgnames
Python auto-generated iOS each size specification icon