Automatic cropping tool (C #) for the latest IOS Application Development Icon #)

Source: Internet
Author: User

Automatic cropping tool (C #) for the latest IOS Application Development Icon #)

Early in the past, I developed IOS apps. I used C # To write a simple IOS APP development Icon Type Auto-cropping device for IOS apps, at present, there are more and more screen specifications for IOS devices. One version requires several types of resolution icons, which are hard to generate one by one with PS. If there are changes to the Icon, You have to generate it again, therefore, it is easier for the whole program to do this job.

The idea is very simple, leading to a large image (Note: This figure must be greater than or equal to 1024*1024, because the iTunesArtwork @ 2x specification is1024*1024), Generate a small image corresponding to the pixel, and save it.

First, let's take a look at the current Icon specifications:

//for Ad Hoc OnlyiTunesArtwork@2x:1024*1024iTunesArtwork:512*512//for App IconIcon-60@3x.png:180*180//iPhone 6 Plus (@3x)Icon-60@2x.png:120*120//iPhone 6 and iPhone 5 (@2x)Icon-76@2x.png:152*152//iPad and iPad mini (@2x)Icon-76.png:76*76//iPad 2 and iPad mini (@1x)Icon.png:57*57//iPhone Non-Retina (iOS 6.1 and Prior)Icon@2x.png:114*114//iPhone Retina (iOS 6.1 and Prior)Icon-72.png:72*72//iPad Non-Retina (iOS 6.1 and Prior)Icon-72@2x.png:144*144//iPad Retina (iOS 6.1 and Prior)//for Spotlight search results iconIcon-40.png:40*40//iPad Non-RetinaIcon-40@2x.png:80*80 //iPad RetinaIcon-40@3x.png:120*120 //iPhone 6 Plus//for Settings iconIcon-29.png:29*29//iPhone Non-Retina (iOS 6.1 and Prior)Icon-29@2x.png:58*58//iPhone Retina (iOS 6.1 and Prior)Icon-29@3x.png:87*87//iPhone 6 PlusIcon-50.png:50*50//iPad Non-Retina (iOS 6.1 and Prior)Icon-50@2x.png:100*100//iPad Retina (iOS 6.1 and Prior)

Here I use C # To write, mainly considering that the Bitmap class in C # has a GetThumbnailImage () method that can easily narrow down the image. The following is a simple packaging function for image cropping:

////// Method for obtaining proportional scaling images //////Image path to be scaled///Zoom image save path///Scaling image save format///Width or height to be maintained///
 Public bool GetThumbnail (string imgPath, string savePath, ImageFormat format, int scaling) {try {using (Bitmap myBitmap = new Bitmap (imgPath) {using (Image myThumbnail = myBitmap. getThumbnailImage (scaling, scaling, () =>{ return false ;}, IntPtr. zero) {myThumbnail. save (savePath, format) ;}} return true ;}catch {return false ;}}

Final run:

Generated Icon:

Download: http://download.csdn.net/detail/wangqiuyun/7976361

Reprinted Please note: http://blog.csdn.net/wangqiuyun/article/details/39576293


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.