derdida
derdida

Reputation: 14904

iOS save combined image

I´ve created an draw module, where i am able to draw over an background image. The "drawings" are an transparent PNG, and i combine it when ill save the image.

But the problem here is that the contrast is sometimes bad to see (see image below).

Before (on paint mode):

enter image description here

After (when ill multiply both images):

enter image description here

(hard to see any yellow).

I multiply both images with:

  UIGraphicsBeginImageContextWithOptions(size, false, 0.0)
  bottomImage!.draw(in: CGRect(x: 0,y: 0,width: size.width, height: size.height))
  topImage!.draw(in: CGRect(x: 0,y: 0,width: size.width, height: size.height), blendMode: CGBlendMode.multiply , alpha: 1.0)
  combinedImage = UIGraphicsGetImageFromCurrentImageContext()
  UIGraphicsEndImageContext()

Any ideas how can i get better colors?

Upvotes: 0

Views: 59

Answers (1)

matt
matt

Reputation: 535988

Cut the part about the blend mode. Just draw the "painting" (topImage) directly onto the background (bottomImage).

Upvotes: 1

Related Questions