{"id":118,"date":"2016-10-27T10:00:39","date_gmt":"2016-10-27T04:30:39","guid":{"rendered":"https:\/\/www.innovationm.com\/blog\/?p=118"},"modified":"2016-10-27T12:55:25","modified_gmt":"2016-10-27T07:25:25","slug":"image-handling-in-ios","status":"publish","type":"post","link":"https:\/\/www.innovationm.com\/blog\/image-handling-in-ios\/","title":{"rendered":"Image Handling in iOS"},"content":{"rendered":"<p dir=\"ltr\"><span style=\"line-height: 1.714285714; font-size: 1rem;\">When we use images in our application then we face different type of scenarios while handling the image.\u00a0<\/span><span style=\"line-height: 1.714285714; font-size: 1rem;\">Before we go into the scenarios \/ situations of image handling in Application, let us understand the concept of UIImage and UIImageView.<\/span><\/p>\n<h2><span style=\"color: #3366ff;\">Concept of UIImage and UIImageView (container)<\/span><\/h2>\n<p dir=\"ltr\"><strong>UIImage<\/strong>\u00a0&#8211; Bitmap with different formats Ex png and jpeg. Recommended format is png. <strong>UIImageView<\/strong> &#8211;\u00a0<span style=\"font-weight: 400;\">It is iOS control that is used to hold the image, i.e. image container.<\/span><\/p>\n<p dir=\"ltr\">When UIImage is shown in UIImageView, there is a property (Content Mode) of UIImageView, that render the Image in UIImageView. We mostly use three types of Content Mode property. These are:<\/p>\n<ul>\n<li>Scale To Fill<\/li>\n<li>Aspect Fit<\/li>\n<li>Aspect Fill<\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">While using UIImageView in iOS we should use appropriate content mode to show the image. <\/span><\/p>\n<p dir=\"ltr\">How these Content Mode render the image we can see by following examples<\/p>\n<ul>\n<li>UIImage of size (100&#215;150)<\/li>\n<li>UIImageView of size (200&#215;200)<\/li>\n<\/ul>\n<h2><span style=\"color: #3366ff;\">Different Content modes for placing Image in ImageView\u00a0<\/span><\/h2>\n<h3><strong>1. Scale To Fill<\/strong><\/h3>\n<p dir=\"ltr\">It is the default mode. In this case,\u00a0content is scaled to fill in ImageView with distorted or same aspect ratio. If the image aspect ratio is different than that of container then final image ratio when fitted in the container will be different and hence the image is finally distorted.<\/p>\n<p dir=\"ltr\"><em>(Aspect Ratio is Width \/ Height)<\/em><\/p>\n<p dir=\"ltr\"><a href=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/innovationm-image-handling-in-ios-1-.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-1209\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/innovationm-image-handling-in-ios-1-.png\" alt=\"InnovationM Image Handling in iOS\" width=\"120\" height=\"384\" \/><\/a><\/p>\n<h3><strong>2. Aspect Fit<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">It scales the image until it touches first boundary ( either width or height ) of container while maintaining the Aspect Ratio. It shows complete content of image. It may leave some blank area in container.<\/span><\/p>\n<p dir=\"ltr\"><a href=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/innovationm-image-handling-in-ios-2.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-1210\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/innovationm-image-handling-in-ios-2.png\" alt=\"InnovationM Image Handling in iOS\" width=\"120\" height=\"384\" \/><\/a><\/p>\n<h3><strong>3. Aspect Fill Without Clipping<\/strong><\/h3>\n<p><span style=\"font-weight: 400;\">It scales the image until it touches both boundaries of container while maintaining the Aspect Ratio. In this mode it may be that we can not see complete image, because some part of image would be out of container boundary.<\/span><\/p>\n<p dir=\"ltr\"><a href=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/innovationm-image-handling-in-ios-3.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-1211\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/innovationm-image-handling-in-ios-3.png\" alt=\"InnovationM Image Handling in iOS\" width=\"120\" height=\"384\" \/><\/a><\/p>\n<h3><strong>4. Aspect Fill With Clipping <\/strong><\/h3>\n<p dir=\"ltr\">In this case,\u00a0content is scaled to fill in ImageView the same way it happen in the above case but then finally image is cropped to the exact size of the ImageView size.<\/p>\n<p><a href=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/innovationm-image-handling-in-ios-4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1212\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/innovationm-image-handling-in-ios-4.png\" alt=\"InnovationM Image Handling in iOS\" width=\"120\" height=\"384\" \/><\/a><\/p>\n<h3><b>5. Redraw\u00a0<\/b><\/h3>\n<p><span style=\"font-weight: 400;\">It calls <\/span><b>drawInRect: <\/b><span style=\"font-weight: 400;\">method every time when container bounds changes. It is much slower. We should avoid to use it.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">All other Content Modes like Center, Top, Bottom, Left, Right, Top Left, Top Right, Bottom Left, Bottom Right will align the image accordingly without scaling it.<\/span><\/p>\n<h2><span style=\"color: #3366ff;\"><strong>Calculating new width and height with maintaining aspect ratio<\/strong><\/span><\/h2>\n<p>Image original width = 100 and height = 150<br \/>\nContainer width \u00a0= 200 and height = 200<\/p>\n<p><strong>x-ratio<\/strong> = Container width \/ Image original width =\u00a0200\/100 = <strong>2.0<\/strong><br \/>\n<strong>y-ratio<\/strong> = \u00a0Container height\u00a0\/ Image original height = 200\/ 150 = \u00a0<strong>1.33<\/strong><\/p>\n<p>Selected ratio = min (x-ratio, y-ratio) = 1.33<\/p>\n<p><strong>Final Image width<\/strong> = Image original width * Selected Ratio =\u00a0100 * 1.33 = <strong>133<\/strong><br \/>\n<strong>Final Image height<\/strong>\u00a0= Image original height * Selected Ratio = 150 * 1.33 = <strong>200<\/strong><\/p>\n<p>Final Image width x height = <strong>133 x 200\u00a0<\/strong>(Original width x height of image was 100 x 150)<\/p>\n<h2><span style=\"color: #3366ff;\"><strong>Showing Images coming from Server (Different Scenarios)<\/strong><\/span><\/h2>\n<p><span style=\"line-height: 1.714285714; font-size: 1rem;\">We can use Aspect Fit mode for all the scenarios. It will serve in every scenario if you don&#8217;t want to distort image.<\/span><\/p>\n<p><strong>Scenario 1<\/strong><br \/>\nImage width is lesser than Container width.<br \/>\nImage height is lesser than Container height.<\/p>\n<p>Image width = 100 and height = 150<br \/>\nUIImageView width = 200 and height = 200<\/p>\n<p>Final Image width = 133 \u00a0and height = 200 (Refer the calculations above)<br \/>\nImage is scaled up to fit the container.<\/p>\n<p><a href=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/innovationm-image-handling-in-ios-5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1213\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/innovationm-image-handling-in-ios-5.png\" alt=\"InnovationM Image Handling in iOS\" width=\"120\" height=\"384\" \/><\/a><\/p>\n<p><strong><strong>Scenario 2\u00a0<\/strong><\/strong><br \/>\nImage width is greater than Container width.<br \/>\nImage height is lesser than Container height.<\/p>\n<p>Image width = 100 and height = 150<br \/>\nUIImageView width = 80 and height = 200<\/p>\n<p>Final Image width\u00a0= 80 and height = 122<br \/>\nImage is scaled down to fit the container.<\/p>\n<p><a href=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/innovationm-image-handling-in-ios-6.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1214\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/innovationm-image-handling-in-ios-6.png\" alt=\"InnovationM Image Handling in iOS\" width=\"120\" height=\"384\" \/><\/a><\/p>\n<p><strong>Scenario 3<\/strong><br \/>\nImage width is lesser than Container width.<br \/>\nImage height is greater than Container height.<\/p>\n<p>Image width = 100 and height = 150<br \/>\nUIImageView width = 200 and height = 120<\/p>\n<p>Final width = 80 \u00a0and height = 120<br \/>\nImage is scaled down to fit the container.<br \/>\n<a href=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/innovationm-image-handling-in-ios-7.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1215\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/innovationm-image-handling-in-ios-7.png\" alt=\"InnovationM Image Handling in iOS\" width=\"120\" height=\"384\" \/><\/a><\/p>\n<p><strong>Scenario 4<\/strong><br \/>\nImage width is greater than Container width.<br \/>\nImage height is greater than Container height.<\/p>\n<p>Image width = 100 and height = 150<br \/>\nUIImageView width = 80 and height = 100<\/p>\n<p>Final width = 66 \u00a0and height = 100<br \/>\nImage is scaled down to fit the container.<\/p>\n<p><a href=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/innovationm-image-handling-in-ios-8.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1216\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/innovationm-image-handling-in-ios-8.png\" alt=\"InnovationM Image Handling in iOS\" width=\"120\" height=\"384\" \/><\/a><\/p>\n<p><strong style=\"line-height: 1.714285714; font-size: 1rem;\">Scenario 5 (Same Aspect Ratio of Image and ImageView)<\/strong><br \/>\nImage width is greater than Container width.<br \/>\nImage height is greater than Container height.<\/p>\n<p>Image width = 100 and height = 150<br \/>\nUIImageView width = 80 and height = 120<\/p>\n<p>Final width = 80 and height = 120<br \/>\nImage is scaled down to fit the container.<\/p>\n<p><a href=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/innovationm-image-handling-in-ios-9.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1217\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/innovationm-image-handling-in-ios-9.png\" alt=\"InnovationM Image Handling in iOS\" width=\"120\" height=\"384\" \/><\/a><\/p>\n<p><strong>Scenario 6\u00a0<strong>(Same Aspect Ratio of Image and ImageView)<\/strong><\/strong><br \/>\nImage width is lesser than Container width.<br \/>\nImage height is lesser than Container height.<\/p>\n<p>Image width = 100 and height = 150<br \/>\nUIImageView width = 120 and height = 180<\/p>\n<p>Final width = 120 and height = 180<br \/>\nImage is scaled up to fit the container.<\/p>\n<p><a href=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/innovationm-image-handling-in-ios-10.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1218\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/innovationm-image-handling-in-ios-10.png\" alt=\"InnovationM Image Handling in iOS\" width=\"120\" height=\"384\" \/><\/a><\/p>\n<p dir=\"ltr\">How we change the image size and compress image file size-<\/p>\n<h2><span style=\"color: #3366ff;\"><b>Uploading Images to the Server (Different Scenarios)<\/b><\/span><\/h2>\n<p dir=\"ltr\">Many times we have to upload images in an application from device (iPhone, iPad) to the server. It could be a photo clicked from the camera or there was an old image that we choose and upload from the application.<\/p>\n<p dir=\"ltr\">Before uploading we can do two things with the image:<\/p>\n<p>1. Change the width and height of original image.<br \/>\n2. Compress the image to be of smaller file size.<\/p>\n<p dir=\"ltr\">Let us understand them.<\/p>\n<p dir=\"ltr\"><strong>1. Change the width and height of original image.<\/strong><\/p>\n<p dir=\"ltr\">To resize the image, we have to configure the drawing environment for rendering into a bitmap.<\/p>\n<p><b>1#<\/b><span style=\"font-weight: 400;\"> func UIGraphicsBeginImageContextWithOptions(_ size: CGSize, _ opaque: Bool, _ scale: CGFloat)<\/span><\/p>\n<p><span style=\"font-weight: 400;\"> \u00a0method is used to create the bitmap-based graphics context.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">This method takes three parameters:<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Size of image (changed size)<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Opaque (Bool type)<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Scale factor of device as parameter ( eg. 1.0, 2.0, 3.0 )<\/span><\/li>\n<\/ol>\n<p><b>2#<\/b><span style=\"font-weight: 400;\"> \u2013 func draw(in rect: CGRect); <\/span><\/p>\n<p><span style=\"font-weight: 400;\">method is used to draw the image in target rectangle.<\/span><\/p>\n<p><b>3# <\/b><span style=\"font-weight: 400;\">func UIGraphicsGetImageFromCurrentImageContext() -&gt; UIImage?<\/span><\/p>\n<p><span style=\"font-weight: 400;\"> method is used to get the resized image from drawing environment.<\/span><\/p>\n<p><b>4#<\/b><span style=\"font-weight: 400;\"> func UIGraphicsEndImageContext()<\/span><\/p>\n<p><span style=\"font-weight: 400;\"> method is used to clean up the bitmap drawing environment and remove the graphics context from the top of the context stack.<\/span><\/p>\n<p><b>Example :<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Original source Image \u00a0Size =<\/span><b> (188, 268)<\/b><br \/>\n<span style=\"font-weight: 400;\">Original source image file size = 49 KB<\/span><br \/>\n<span style=\"font-weight: 400;\">After resizing image to size (100, 100):<\/span><br \/>\n<span style=\"font-weight: 400;\">Resized source Image \u00a0Size =<\/span><b> (71, 100)<\/b><br \/>\n<span style=\"font-weight: 400;\">Resized source image file size = 10 KB<\/span><\/p>\n<p><b>Code Example:<\/b><a href=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/h12.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-2246\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/h12.png\" alt=\"h1\" width=\"550\" height=\"522\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/h12.png 550w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/h12-300x285.png 300w\" sizes=\"(max-width: 550px) 100vw, 550px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>2. Compress the image to be of smaller file size.<\/strong><\/p>\n<p>We can compress the image file size by following method.<\/p>\n<p><span style=\"font-weight: 400;\">func UIImageJPEGRepresentation(_ image: UIImage, _ compressionQuality: CGFloat) -&gt; Data?<\/span><\/p>\n<p><span style=\"font-weight: 400;\">This method takes two arguments &#8211;<\/span><\/p>\n<ol>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">UIImage object.<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">CompressionQuality (It can be from 0.0 to 1.0) where<\/span><\/li>\n<\/ol>\n<p>0.0 means most compression<br \/>\n<span style=\"font-weight: 400;\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a01.0 means least compression<\/span><\/p>\n<p><span style=\"font-weight: 400;\">This method will return NSData representation of image after compressing.<\/span><\/p>\n<p><b>Example :<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Original source Image \u00a0Size = (188, 268)<\/span><br \/>\n<span style=\"font-weight: 400;\">Original source image file size =<\/span><b> 49 KB<\/b><br \/>\n<span style=\"font-weight: 400;\">After compressing image file \u00a0size by 0.5:<\/span><br \/>\n<span style=\"font-weight: 400;\">Resized source Image \u00a0Size = (188, 268)<\/span><br \/>\n<span style=\"font-weight: 400;\">Resized source image file size =<\/span><b> 6 KB<\/b><\/p>\n<p><b>Code Example:<\/b><span style=\"font-weight: 400;\"><a href=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/h11.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-2245\" src=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/h11.png\" alt=\"h1\" width=\"578\" height=\"172\" srcset=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/h11.png 578w, https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/h11-300x89.png 300w\" sizes=\"(max-width: 578px) 100vw, 578px\" \/><\/a><\/span><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">Depending upon your requirement whether to reduce the size (width and height in pixels) OR reduce the file size OR Both, you may apply the above.<\/span><\/p>\n<p>Have Fun \u2026<\/p>\n<p><strong>For building world-class iOS solutions, contact sales@innovationm.com<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>When we use images in our application then we face different type of scenarios while handling the image.\u00a0Before we go into the scenarios \/ situations of image handling in Application, let us understand the concept of UIImage and UIImageView. Concept of UIImage and UIImageView (container) UIImage\u00a0&#8211; Bitmap with different formats Ex png and jpeg. Recommended [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1220,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,71,8],"tags":[129,128,130,131,127,14,160,122,89,22,126],"class_list":["post-118","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ios","category-mobile","category-mobile-architecture-and-design","tag-aspect-fill","tag-aspect-fit","tag-compress","tag-compress-file-size","tag-content-mode","tag-innovationm","tag-ios","tag-ipad","tag-iphone","tag-uiimage","tag-uiimageview"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Image Handling in iOS | InnovationM Blog<\/title>\n<meta name=\"description\" content=\"Different types of scenarios faced while handling images in iOS application.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.innovationm.com\/blog\/image-handling-in-ios\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Image Handling in iOS | InnovationM Blog\" \/>\n<meta property=\"og:description\" content=\"Different types of scenarios faced while handling images in iOS application.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.innovationm.com\/blog\/image-handling-in-ios\/\" \/>\n<meta property=\"og:site_name\" content=\"InnovationM - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2016-10-27T04:30:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2016-10-27T07:25:25+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/innovationm-image-handling-in-ios-00.png\" \/>\n\t<meta property=\"og:image:width\" content=\"624\" \/>\n\t<meta property=\"og:image:height\" content=\"250\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"InnovationM Admin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"InnovationM Admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/image-handling-in-ios\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/image-handling-in-ios\\\/\"},\"author\":{\"name\":\"InnovationM Admin\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\"},\"headline\":\"Image Handling in iOS\",\"datePublished\":\"2016-10-27T04:30:39+00:00\",\"dateModified\":\"2016-10-27T07:25:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/image-handling-in-ios\\\/\"},\"wordCount\":1085,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/image-handling-in-ios\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/01\\\/innovationm-image-handling-in-ios-00.png\",\"keywords\":[\"Aspect Fill\",\"Aspect Fit\",\"Compress\",\"Compress file size\",\"Content Mode\",\"InnovationM\",\"iOS\",\"iPad\",\"iPhone\",\"UIImage\",\"UIImageView\"],\"articleSection\":[\"iOS\",\"Mobile\",\"Mobile Architecture and Design\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/image-handling-in-ios\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/image-handling-in-ios\\\/\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/image-handling-in-ios\\\/\",\"name\":\"Image Handling in iOS | InnovationM Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/image-handling-in-ios\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/image-handling-in-ios\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/01\\\/innovationm-image-handling-in-ios-00.png\",\"datePublished\":\"2016-10-27T04:30:39+00:00\",\"dateModified\":\"2016-10-27T07:25:25+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\"},\"description\":\"Different types of scenarios faced while handling images in iOS application.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/image-handling-in-ios\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/image-handling-in-ios\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/image-handling-in-ios\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/01\\\/innovationm-image-handling-in-ios-00.png\",\"contentUrl\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/01\\\/innovationm-image-handling-in-ios-00.png\",\"width\":624,\"height\":250,\"caption\":\"InnovationM Image Handling in iOS\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/image-handling-in-ios\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Image Handling in iOS\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/\",\"name\":\"InnovationM - Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/#\\\/schema\\\/person\\\/a831bf4602d69d1fa452e3de0c8862ed\",\"name\":\"InnovationM Admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g\",\"caption\":\"InnovationM Admin\"},\"sameAs\":[\"http:\\\/\\\/www.innovationm.com\\\/\"],\"url\":\"https:\\\/\\\/www.innovationm.com\\\/blog\\\/author\\\/innovationmadmin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Image Handling in iOS | InnovationM Blog","description":"Different types of scenarios faced while handling images in iOS application.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.innovationm.com\/blog\/image-handling-in-ios\/","og_locale":"en_US","og_type":"article","og_title":"Image Handling in iOS | InnovationM Blog","og_description":"Different types of scenarios faced while handling images in iOS application.","og_url":"https:\/\/www.innovationm.com\/blog\/image-handling-in-ios\/","og_site_name":"InnovationM - Blog","article_published_time":"2016-10-27T04:30:39+00:00","article_modified_time":"2016-10-27T07:25:25+00:00","og_image":[{"width":624,"height":250,"url":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/innovationm-image-handling-in-ios-00.png","type":"image\/png"}],"author":"InnovationM Admin","twitter_misc":{"Written by":"InnovationM Admin","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.innovationm.com\/blog\/image-handling-in-ios\/#article","isPartOf":{"@id":"https:\/\/www.innovationm.com\/blog\/image-handling-in-ios\/"},"author":{"name":"InnovationM Admin","@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed"},"headline":"Image Handling in iOS","datePublished":"2016-10-27T04:30:39+00:00","dateModified":"2016-10-27T07:25:25+00:00","mainEntityOfPage":{"@id":"https:\/\/www.innovationm.com\/blog\/image-handling-in-ios\/"},"wordCount":1085,"commentCount":0,"image":{"@id":"https:\/\/www.innovationm.com\/blog\/image-handling-in-ios\/#primaryimage"},"thumbnailUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/innovationm-image-handling-in-ios-00.png","keywords":["Aspect Fill","Aspect Fit","Compress","Compress file size","Content Mode","InnovationM","iOS","iPad","iPhone","UIImage","UIImageView"],"articleSection":["iOS","Mobile","Mobile Architecture and Design"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.innovationm.com\/blog\/image-handling-in-ios\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.innovationm.com\/blog\/image-handling-in-ios\/","url":"https:\/\/www.innovationm.com\/blog\/image-handling-in-ios\/","name":"Image Handling in iOS | InnovationM Blog","isPartOf":{"@id":"https:\/\/www.innovationm.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.innovationm.com\/blog\/image-handling-in-ios\/#primaryimage"},"image":{"@id":"https:\/\/www.innovationm.com\/blog\/image-handling-in-ios\/#primaryimage"},"thumbnailUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/innovationm-image-handling-in-ios-00.png","datePublished":"2016-10-27T04:30:39+00:00","dateModified":"2016-10-27T07:25:25+00:00","author":{"@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed"},"description":"Different types of scenarios faced while handling images in iOS application.","breadcrumb":{"@id":"https:\/\/www.innovationm.com\/blog\/image-handling-in-ios\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.innovationm.com\/blog\/image-handling-in-ios\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.innovationm.com\/blog\/image-handling-in-ios\/#primaryimage","url":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/innovationm-image-handling-in-ios-00.png","contentUrl":"https:\/\/www.innovationm.com\/blog\/wp-content\/uploads\/2014\/01\/innovationm-image-handling-in-ios-00.png","width":624,"height":250,"caption":"InnovationM Image Handling in iOS"},{"@type":"BreadcrumbList","@id":"https:\/\/www.innovationm.com\/blog\/image-handling-in-ios\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.innovationm.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Image Handling in iOS"}]},{"@type":"WebSite","@id":"https:\/\/www.innovationm.com\/blog\/#website","url":"https:\/\/www.innovationm.com\/blog\/","name":"InnovationM - Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.innovationm.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.innovationm.com\/blog\/#\/schema\/person\/a831bf4602d69d1fa452e3de0c8862ed","name":"InnovationM Admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5c99d9eece9dfbc82297cf34ddd58e9fe05bb52fe66c8f6bf6c0a45bfb6d7629?s=96&r=g","caption":"InnovationM Admin"},"sameAs":["http:\/\/www.innovationm.com\/"],"url":"https:\/\/www.innovationm.com\/blog\/author\/innovationmadmin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts\/118","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/comments?post=118"}],"version-history":[{"count":0,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/posts\/118\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/media\/1220"}],"wp:attachment":[{"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/media?parent=118"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/categories?post=118"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.innovationm.com\/blog\/wp-json\/wp\/v2\/tags?post=118"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}