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.


   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

iOS webp convert jpg

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.