简体   繁体   中英

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):

在此处输入图片说明

After (when ill multiply both images):

在此处输入图片说明

(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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM