iOS webp convert jpg

Source: Internet
Author: User
Tags webp

In the process of project development, encountered a problem, is the picture of WEBP, first explain what WEBP is, WEBP is a Google developed to speed up the image of the image format. Image compression volume of about only 2/3 jpeg, plainly is the province of space, especially for mobile apps to the size of the application is still very necessary to save the province.

The problem comes, Apple native does not support WEBP type of picture, then need third-party support, but the third party on the Internet may need to use the cocoapods, but the personal feeling does not like to use, so they need to integrate the resources, in fact, some resources files, got together, Can be directly used on the line, personal feeling very convenient. In this share to everyone.

This is GitHub's address: HTTPS://GITHUB.COM/YOUZHIZHESHIJINGCHENG/YZWEBP

   Put the downloaded files directly into the project, then you need toYZ.huiimage+webp.h import to pch file inside , Then find the project  target -> Build setting->linking->other Linker flags  or  -force_load < Span class= "S1" style= "Line-height:normal;" > or  -objc

uiimageview* Imagev=[[uiimageview Alloc]initwithframe:cgrectmake (a);

  The premise is that 11108.webp images can be in the project.

  NSString *pathstr = [[NSBundle mainbundle] pathforresource:@ "11108.WEBP" oftype:nil];

  Imagev.image=[uiimage IMAGEWITHWEBP:PATHSTR];

  [Self.view Addsubview:imagev];

That's it, it feels good to write.


This article is from the "Red Corner Antelope" blog, please be sure to keep this source http://2254359459.blog.51cto.com/10776102/1912470

iOS webp convert jpg

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.