### Godot version

2a0aef5f09

### System information

Windows 11, Ryzen 9 5950X, RTX 3090 (531.79) Vulkan, 64GB RAM

### Issue description

The issue occurs due to two things.
When textures/images are imported, the `fix_alpha_edges` / `fix_alpha_borders` function in the importer will modify the color values but leaves the alpha values unchanged.

Later, when using the `_convert` function in the `image.cpp` file or `Image::convert` to convert from `Image::FORMAT_RGBA` to `Image::FORMAT_L8` the following image results (raw on top, conversion on bottom).
![Clipboard - May 22, 2023 8_13 PM](https://github.com/godotengine/godot/assets/5207577/52f4597e-17b6-48c5-8fb4-d6d37012d8f4)

I, originally, thought that the `fix_alpha_edges` / `fix_alpha_borders` code was at fault but it turns out to not necessarily be the case.  I modified the `_convert` function in `image.cpp` to calculate grayscale values correctly and to consider the alpha channel or not and now I'm getting the expected output as shown here:
![Clipboard - May 23, 2023 7_16 AM](https://github.com/godotengine/godot/assets/5207577/73babb20-22bb-4f23-808f-5d49dce55f2d)


### Steps to reproduce

Import `Image::FORMAT_RGBA` image into any project.

Convert image in code by calling the `convert` function to `Image::FORMAT_L8`.

Screen shot of MRP here:
![image](https://github.com/godotengine/godot/assets/5207577/9d7d0078-5e41-45d1-b5c5-fc291b839fa9)


### Minimal reproduction project

Attached now
[Issue_77393.zip](https://github.com/godotengine/godot/files/11545149/Issue_77393.zip)

ClassDB::bind_method(D_METHOD("get_width"), &Image::get_width);
	ClassDB::bind_method(D_METHOD("get_height"), &Image::get_height);
	ClassDB::bind_method(D_METHOD("get_size"), &Image::get_size);
	ClassDB::bind_method(D_METHOD("has_mipmaps"), &Image::has_mipmaps);
	ClassDB::bind_method(D_METHOD("get_format"), &Image::get_format);
	ClassDB::bind_method(D_METHOD("get_data"), &Image::get_data);
	ClassDB::bind_method(D_METHOD("convert", "format"), &Image::convert);
	ClassDB::bind_method(D_METHOD("get_mipmap_offset", "mipmap"), &Image::get_mipmap_offset);
	ClassDB::bind_method(D_METHOD("resize_to_po2", "square", "interpolation"), &Image::resize_to_po2, DEFVAL(false), DEFVAL(INTERPOLATE_BILINEAR));
	ClassDB::bind_method(D_METHOD("resize", "width", "height", "interpolation"), &Image::resize, DEFVAL(INTERPOLATE_BILINEAR));
	ClassDB::bind_method(D_METHOD("shrink_x2"), &Image::shrink_x2);
	ClassDB::bind_method(D_METHOD("crop", "width", "height"), &Image::crop);
	ClassDB::bind_method(D_METHOD("flip_x"), &Image::flip_x);
	ClassDB::bind_method(D_METHOD("flip_y"), &Image::flip_y);
	ClassDB::bind_method(D_METHOD("generate_mipmaps", "renormalize"), &Image::generate_mipmaps, DEFVAL(false));
	ClassDB::bind_method(D_METHOD("clear_mipmaps"), &Image::clear_mipmaps);
	ClassDB::bind_static_method("Image", D_METHOD("create", "width", "height", "use_mipmaps", "format"), &Image::create_empty);
	ClassDB::bind_static_method("Image", D_METHOD("create_from_data", "width", "height", "use_mipmaps", "format", "data"), &Image::create_from_data);
	ClassDB::bind_method(D_METHOD("set_data", "width", "height", "use_mipmaps", "format", "data"), &Image::set_data);
	ClassDB::bind_method(D_METHOD("is_empty"), &Image::is_empty);
	ClassDB::bind_method(D_METHOD("load", "path"), &Image::load);
	ClassDB::bind_static_method("Image", D_METHOD("load_from_file", "path"), &Image::load_from_file);
	ClassDB::bind_method(D_METHOD("save_png", "path"), &Image::save_png);