### ImageMagick version

7.1.1.13

### Operating system

MacOS

### Operating system, version and so on

Ventura

### Description

I have this grayscale image with no alpha channel.  I am trying to add a gradient in the alpha channel but it does not show up if the image is grayscale. But works if I convert the image to srgb.

![img](https://github.com/ImageMagick/ImageMagick/assets/13458218/965231cf-f29c-443c-84a6-cdd86a7946c7)

**# Works fine in IM 6**
```
convert img.png -alpha set -background none -channel A \
-sparse-color barycentric "0,%[h] none 0,800 white" \
+channel img_fade.png
```

![img_fade](https://github.com/ImageMagick/ImageMagick/assets/13458218/77a3d58b-d25b-4723-951b-483bb5057084)



**# fails in IM 7 if left grayscale**
```
magick img.png -alpha set -background none -channel A \
-sparse-color barycentric "0,%[h] none 0,800 white" \
+channel img_fade2a.png
```

![img_fade2a](https://github.com/ImageMagick/ImageMagick/assets/13458218/b362f9b0-090e-4f46-a33d-d029c654f7e7)



**# but works in IM 7 if add -colorspace srgb**
```
magick img.png -colorspace sRGB -alpha set -background none -channel A \
-sparse-color barycentric "0,%[h] none 0,800 white" \
+channel img_fade2b.png
```

![img_fade2b](https://github.com/ImageMagick/ImageMagick/assets/13458218/f3fa19dc-bd69-4af5-9dd9-0e08075cea9b)


**Is this expected behavior or is it a bug?**

### Steps to Reproduce

See above

### Images

See above
Alpha gradient fade script fails if image is grayscale but works if srgb
This is a GitHub Issue
repo:ImageMagick
owner:ImageMagick
Title : Alpha gradient fade script fails if image is grayscale but works if srgb
Issue date:

--- start body ---
### ImageMagick version

7.1.1.13

### Operating system

MacOS

### Operating system, version and so on

Ventura

### Description

I have this grayscale image with no alpha channel.  I am trying to add a gradient in the alpha channel but it does not show up if the image is grayscale. But works if I convert the image to srgb.

![img](https://github.com/ImageMagick/ImageMagick/assets/13458218/965231cf-f29c-443c-84a6-cdd86a7946c7)

**# Works fine in IM 6**
```
convert img.png -alpha set -background none -channel A \
-sparse-color barycentric "0,%[h] none 0,800 white" \
+channel img_fade.png
```

![img_fade](https://github.com/ImageMagick/ImageMagick/assets/13458218/77a3d58b-d25b-4723-951b-483bb5057084)



**# fails in IM 7 if left grayscale**
```
magick img.png -alpha set -background none -channel A \
-sparse-color barycentric "0,%[h] none 0,800 white" \
+channel img_fade2a.png
```

![img_fade2a](https://github.com/ImageMagick/ImageMagick/assets/13458218/b362f9b0-090e-4f46-a33d-d029c654f7e7)



**# but works in IM 7 if add -colorspace srgb**
```
magick img.png -colorspace sRGB -alpha set -background none -channel A \
-sparse-color barycentric "0,%[h] none 0,800 white" \
+channel img_fade2b.png
```

![img_fade2b](https://github.com/ImageMagick/ImageMagick/assets/13458218/f3fa19dc-bd69-4af5-9dd9-0e08075cea9b)


**Is this expected behavior or is it a bug?**

### Steps to Reproduce

See above

### Images

See above
--- end body ---
