iOS Photo Editing and Enhancement

Editing photos brings out its best features, or focuses on what’s important. There are many tools for this like Photoshop, GIMP or Corel. But these tools are complicated to use for ordinary users. That is why companies like Snapchat and Instagram have created ways to edit photos with ease, and these companies have grown to become multi-million dollar industries. Photo Editing has become a must for Social Networking Services (SNS) if you want to stay relevant in the current trends. 

Here, we are going to show you what are the different methods we use in order to create these images on the iOS platform, specifically four methods. Photo Color Correction, Image Composition Adjustment, Filter, and Layering, and what are the difficulties we encountered in implementing it.

1. Photo Color Correction 

Image color correction has many known methods, and we are going to focus on three. Brightness, Contrast and Saturation. Brightness refers to the overall lightness or darkness of the image. Contrast is the difference in brightness between objects or regions. Saturation refers to the intensity of a color. The higher the saturation of a color, the more vivid it is. The lower the saturation of a color, the closer it is to gray. To achieve this, we utilize a built in function of iOS called the Core Image Functions.

Here is demonstration in code:

We are specifically using the CIColorControls Filter and adjust the values, depending on what we want. Here the keys are inputBrightness, inputContrast, and inputSaturation. They accept a value range of 0 to 1 in float. By default, all images have a value of 0.5. If we go higher on 0.5 on brightness, we make the image lighter and lower than it makes it darker. Contrast also adjust the brightness but between objects. Saturation makes the color more vivid or more dull. Experimentation is always best!

2. Image Composition Adjustment

Image Composition Adjustment is necessary if you want to focus on what is important on the image. We will focus on three functions, Cropping, Zooming, and Rotation. Cropping is used when we need it to trim unnecessary parts of the image or to focus on the parts that matter. Like a very interesting action shot, or the cute face of your baby. Zooming is quite the same with cropping but instead of parts, it adjusts the ratio, making it bigger and closer. Rotation is used on times when the picture taken is not aligned, so we need to rotate it.

On iOS rotation and zooming is simply applied using CGAffineTransform and the built in function on the UIImage. Here is a sample code below:

Here we first apply our rotation adjustment using CGAffineTransform. Then, we crop the image based on the desired coordinates within the image by specifying a Rect coordinate, applying it to the rotated image. Then we combine all of these steps to create a new image! 

3. Filters

What better way to quickly enhance the image than to add filters to it! What changing filters mean that we make some changes to the original color profile of the image. It’s easy to change the mood by adding filters to an image. It can look warm, cold, sunny, old or even make details more noticeable. It can give a sense of art to any normal images that you take.

On iOS, this is simple to achieve using again the Core Image functions. As we have mentioned before, Core Image has many functions aside from CIColorControls. Below is a sample code to demonstrate how it is easy to use:

Here we simply select from filters available from iOS. We can add our custom values to make unique filters! We can also combine other filters to make awesome filters!

4. Layering

What other way can we make our images cute and amazing? By adding stickers! Stickers are images we place on top of our original photo. This method is called Layering. Here we stack images on over the other. By adding unique stickers to our images and text, we can convey more messages to our image. It can show details like sleepy, fun, dates or greetings! Then when we are satisfied, we flatten all these images into one image.

Here is a sample code below:

The code above converts a UIView into an UIImage. This means that we can add as many images inside the UIView and then generate a new image based on it.

Challenges

We have run through the basics of Photo Editing and how we can implement the functions in iOS. But the challenge here is to create beautiful User Interface (UI) and User Experience (UX) that can attract your users. Users must be able to understand and use you application quickly as possible, so that the users won’t be frustrated in using your apps. Some tips we can give are the following

  1. Predetermined Edits

           Filters and Image Composition Adjustment can be premixed so that users won’t do many processes and use your premade edits and can get there edited images right away with no hassle.

     2. Customised stickers

           Making customised stickers for your users like putting their names can be attractive and fun. It gives a sense of community that users can get unique stickers.

Conclusion

It’s not very easy to apply image editing especially when deciding what is the User Interface and Experience, but it is not impossible. With enough time and imagination, you can generate amazing images that will amaze you and your friends. The next step for this one is adding Virtual Reality and Augmented Reality. Virtual Reality and Augmented Reality is becoming very popular today, and people love these features. Stay tuned to our next article about this topic!