Background
All kinds of web sites and tools to generate app icons, feel or use their own heart to write a fun, so spent 1 hours to write a. According to the online icon size specification, all sizes are generated.
A discussion group was built, 533838427. is clearly aimed at the independent development of the brother, this small program also see, Android, iOS a catch, hope also in this trip to the Friends of the abyss of communication.
Source:
Link: http://pan.baidu.com/s/1qXuZgXu Password: IHFP
Description
Written in C #, generates all the icon sizes for Andorid and iOS. If you feel that the size is wrong or the naming rules are inappropriate, you can modify the code immediately. The code inside the note is still very detailed.
1. Modify the dimensions
In model, the size of Android and iOS are stored separately in the array and can be adjusted as needed.
Public classandroidsizes { Public Static int[] mdpisizes = { -, +, -, - }; Public Static int[] hdpisizes = { the, -, -, $ }; Public Static int[] xhdpisizes = { -, +, -, - }; Public Static int[] xxhdpisizes = {144, the, -, the }; } Public classiossizes { Public Static int[] icon3sizes = {1024x768, +, the, the, the, the, the }; Public Static int[] icon2sizes = {1024x768, +, -, the, -, the, - }; Public Static int[] icon1sizes = {1024x768, +, -, $, in, -, - }; }
2. Modifying the Save folder and naming conventions
Now the folder naming specification is iOS by 1X, 2X, 3X directly stored in a folder, named by type
Android is saved according to XHDPI, HDPI, xxhdpi, and is named by size
If you want to modify the name can be found in the form of the BackgroundWorker, here the diagram of the easy logic to write in.
Private stringCreateFolder (stringfile) { stringFilePath =path.getdirectoryname (file); stringFileName =path.getfilenamewithoutextension (file); stringRoot = FilePath +"\\"+FileName; //root directory if(!directory.exists (Root)) {directory.createdirectory (root); } //Sub-directories foreach(stringChildinchchildfolders) { if(! Directory.Exists (Root +"\\"+Child )) {Directory.CreateDirectory (Root+"\\"+Child ); } } returnRoot; } Private voidCreateiosthumbs (stringFolderstringfile) { //@1x foreach(intSizeinchModel.IosSizes.icon1Sizes) {stringThumb = folder +"\\ios\\@1x"+ Size +". PNG"; DAL. Imageconvert.makethumbnail (file, thumb, size, size,"HW"); } //@2x foreach(intSizeinchModel.IosSizes.icon2Sizes) {stringThumb = folder +"\\ios\\@2x"+ Size +". PNG"; DAL. Imageconvert.makethumbnail (file, thumb, size, size,"HW"); } //@3x foreach(intSizeinchModel.IosSizes.icon3Sizes) {stringThumb = folder +"\\ios\\@3x"+ Size +". PNG"; DAL. Imageconvert.makethumbnail (file, thumb, size, size,"HW"); } } Private voidCreateandroidthumbs (stringFolderstringfile) { //"Android", "android\\hdpi", "android\\mdpi", "android\\xhdpi", "android\\xxhdpi"//hdpi foreach(intSizeinchModel.AndroidSizes.hdpiSizes) {stringThumb = folder +"\\android\\hdpi\\"+ Size +". PNG"; DAL. Imageconvert.makethumbnail (file, thumb, size, size,"HW"); } //mdpi foreach(intSizeinchModel.AndroidSizes.mdpiSizes) {stringThumb = folder +"\\android\\mdpi\\"+ Size +". PNG"; DAL. Imageconvert.makethumbnail (file, thumb, size, size,"HW"); } //xhdpi foreach(intSizeinchModel.AndroidSizes.xhdpiSizes) {stringThumb = folder +"\\android\\xhdpi\\"+ Size +". PNG"; DAL. Imageconvert.makethumbnail (file, thumb, size, size,"HW"); } //xxhdpi foreach(intSizeinchModel.AndroidSizes.xxhdpiSizes) {stringThumb = folder +"\\android\\xxhdpi\\"+ Size +". PNG"; DAL. Imageconvert.makethumbnail (file, thumb, size, size,"HW"); } }
Reference
http://www.uigreat.com/guifan/Size Specification
http://www.cnblogs.com/zzy2740/archive/2012/02/29/2374648.html thumbnail generation
App icon Generator Implementation, attached source