Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set blendmodes on UIImageViews like Photoshop

Tags:

ios

quartz-2d

I've been trying to apply blend modes to my UIImageViews to replicate a PSD mock up file (sorry can't provide). The PSD file has 3 layers, a base color with 60% normal blend, an image layer with 55% multiply blend and a gradient layer with 35% overlay.

I've been trying several tutorials over the internet but still could not get the colors/image to be exactly the same.

One thing I noticed is that the color of my iPhone is different from my Mac's screen.

I found the documentation for Quartz 2D which I think is the right way to go, but I could not get any sample/tutorial about Using Blend Modes with Images. https://developer.apple.com/library/mac/documentation/graphicsimaging/conceptual/drawingwithquartz2d/dq_images/dq_images.html#//apple_ref/doc/uid/TP30001066-CH212-CJBIJEFG

Can anyone provide a good tutorial that does the same as the one in the documentation so I could atleast try to mix things up should nobody provide me a straight forward answer to my question.

like image 843
SleepNot Avatar asked Apr 29 '14 08:04

SleepNot


People also ask

How do I change my blending mode to color?

By default, it should be set to Normal. Click on the drop-down menu and select Color. This will change the Blending Mode of the layer to Color. The Color Blending Mode is useful for tinting an image with a solid color.

What is the best blending mode for color tinting black and white photos?

One of the most popular uses for the Color blend mode is to colorize black and white images. This allows you to add color to the image without affecting the lightness values. Simply add a new blank layer above your image and set the blend mode of the layer to Color.

What does overlay blend mode do?

Overlay is another of Photoshop's most Commonly Used Blending Modes. It uses Screen at half strength on colors brighter than 50% gray. And the Multiply at half strength on colors darker than 50% gray. 50% gray itself becomes transparent.

How do you change the blend mode in Photoshop?

Use Photoshop Blending modes At the top of the Layers palette, see an option that says Normal. Click the drop-down menu to see all the available modes. Select one of the modes and see the result in your document window.


1 Answers

This question was asked ages ago, but if someone is looking for the same anwser, you can user compositingFilter on the backing layer of your view to get what you want:

overlayView.layer.compositingFilter = "multiplyBlendMode"

Suggested by @SeanA, here: https://stackoverflow.com/a/46676507/1147286

Filters
Complete list of filters is here
Or you can print out the compositing filter types with

print("Filters:\n",CIFilter.filterNames(inCategory: kCICategoryCompositeOperation))
like image 191
Zoltán Matók Avatar answered Oct 16 '22 17:10

Zoltán Matók