About YYImage

YYImage is a powerful iOS framework that provides efficient image decoding, encoding, and processing capabilities. It offers numerous features to enhance the performance and quality of images used in your iOS apps. With YYImage, you can easily handle animated images, create thumbnails, apply filters, and optimize memory usage.

Key Features

  • Efficient image decoding and encoding
  • Full support for animated images (GIF, APNG, WebP)
  • Image modification and processing capabilities
  • Thumbnail creation
  • Advanced image caching
  • Image format conversion
  • Memory optimization techniques
  • Support for progressive decoding
  • Smart image prefetching
  • Customizable image handling options


You can install YYImage in your iOS project using CocoaPods. Simply add the following line to your Podfile:

pod 'YYImage'


Once you have installed the YYImage framework, you can begin benefiting from its features. Below are some examples of how to use YYImage in your iOS app:

Decoding an Image

To decode an image in your app, you can use the following code:

UIImage *image = [YYImage imageWithData:data];

Creating and Displaying an Animated Image

If you want to handle animated images, such as GIF, APNG, or WebP, you can use YYImage to create animated image objects:

YYImage *animatedImage = [YYImage imageNamed:@"animated_image.gif"];
YYAnimatedImageView *imageView = [[YYAnimatedImageView alloc] initWithImage:animatedImage];
[view addSubview:imageView];

Applying Image Filters

YYImage provides various filters to modify and enhance images. Here’s an example of applying a blur filter:

UIImage *filteredImage = [image yy_imageByBlurRadius:10 tintColor:nil tintMode:kCGBlendModeNormal saturation:1.0 maskImage:nil];

Thumbnail Creation

You can easily create thumbnails from images using YYImage:

UIImage *thumbnailImage = [image yy_imageByResizeToSize:CGSizeMake(100, 100) contentMode:UIViewContentModeScaleAspectFill];

Advanced Image Caching

To optimize image loading and caching, YYImage offers efficient image caching techniques. For example, you can use the following code to retrieve a cached image:

YYImageCache *imageCache = [YYImageCache sharedCache];
UIImage *cachedImage = [imageCache getImageForKey:@"image_url"];

Image Format Conversion

YYImage allows you to convert images between different formats. Here’s an example of converting an image to WebP format:

NSData *webpData = [image yy_imageDataRepresentationWithQuality:0.9f format:YYImageFormatWebP];
YYImage *webpImage = [YYImage imageWithData:webpData];

Optimizing Memory Usage

YYImage provides various techniques to minimize memory usage. For instance, the following code allows you to remove unnecessary image-related data:


Progressive Decoding

You can enable progressive image decoding with YYImage, which allows the image to gradually display at different stages of decoding:

YYAnimatedImageView *progressiveImageView = [[YYAnimatedImageView alloc] init];
progressiveImageView.yy_imageProgressive = YES;

Smart Image Prefetching

YYImage provides an efficient way to prefetch images to provide faster loading times. For example, you can prefetch images with the following code:

NSArray *imageURLs = @[@"image_url_1", @"image_url_2", @"image_url_3"];
YYWebImageManager *webImageManager = [YYWebImageManager sharedManager];
[webImageManager prefetchURLs:imageURLs];

Customizable Image Handling Options

YYImage offers customization options to configure various aspects of image handling. Here’s an example of setting caching options:

YYImageCache *imageCache = [YYImageCache sharedCache];
imageCache.memoryCache.shouldRemoveAllObjectsOnMemoryWarning = YES;
imageCache.memoryCache.shouldRemoveAllObjectsWhenEnteringBackground = YES;


YYImage is a powerful iOS framework that simplifies and optimizes image handling in your iOS projects. Whether you need to decode, encode, modify, or optimize images, YYImage provides an extensive range of features to help you achieve your goals efficiently. Start leveraging the capabilities of YYImage in your iOS apps today.