Image.grayscale(1.0) returns a full color image in SwiftUI

Viewed 1869

I'm trying to convert an image to full grayscale with SwiftUI and am using .grayscale().

The documentation says the following for this method:

The intensity of grayscale to apply. Values closer to 0.0 are more colorful, and values closer to 1.0 are less colorful.

However, when I use .grayscale(1.0) a full-color image is returned but .grayscale(0.99) returns a full grayscale image.

Is this just a bug with SwiftUI or am I misunderstanding how this method works?

2 Answers

I'm guessing its a bug, but you can also use .saturation(0.0) and .saturation(1.0) to get the effect you're looking for.

Related