Ability to disable alpha channel from image snapshots
NachoSoto opened this issue · 1 comments
NachoSoto commented
Looks like there is no way to make snapshots opaque? It would save a lot of space to remove the alpha channel when not needed.
CraigSiemens commented
We wanted this as well, though for a different reason #673 (comment)
We made a custom Snapshotting
instance named opaqueImage
that always adds a white background to the image. I'm not sure it reduces the file size, but it's a step closer to being able to do that.
Snapshotting<UIView, UIImage>
.image(
size: size,
traits: traits
)
.pullback { view in
let backgroundView = UIView(frame: view.frame)
backgroundView.backgroundColor = .white
backgroundView.preservesSuperviewLayoutMargins = true
backgroundView.addSubview(view)
return backgroundView
}