Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

7. Working with Images > Recipe: Building Thumbnails from Images

Recipe: Building Thumbnails from Images

Thumbnails play an important role in any application that uses images. Often you need to resize an image to fit into a smaller space. Sure, you can load up a UIImageView with the full-sized original and resize its frame, but you can save a lot of memory by redrawing that image into fewer bytes. Thumbnails can use one of three approaches, as demonstrated in Figure 7-9:

• Resize the image while retaining its proportions, fitting it so every part of the image remains visible. Depending on the image’s aspect ratio, you’ll need to either letterbox or pillarbox some extra area, matting the image with transparent pixels.

• Punch out part of the image to match the available space. The example in Figure 7-9 chooses a centered subimage and crops any elements that fall outside the pixel area.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint