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

ERR_FAIL_COND_MSG(!_can_modify(format), "Cannot crop in compressed or custom image formats.");
	ERR_FAIL_COND_MSG(p_x < 0, "Start x position cannot be smaller than 0.");
	ERR_FAIL_COND_MSG(p_y < 0, "Start y position cannot be smaller than 0.");
	ERR_FAIL_COND_MSG(p_width <= 0, "Width of image must be greater than 0.");
	ERR_FAIL_COND_MSG(p_height <= 0, "Height of image must be greater than 0.");
	ERR_FAIL_COND_MSG(p_x + p_width > MAX_WIDTH, "End x position cannot be greater than " + itos(MAX_WIDTH) + ".");
	ERR_FAIL_COND_MSG(p_y + p_height > MAX_HEIGHT, "End y position cannot be greater than " + itos(MAX_HEIGHT) + ".");
	/* to save memory, cropping should be done in-place, however, since this function
	   will most likely either not be used much, or in critical areas, for now it won't, because
	   it's a waste of time. */
	if (p_width == width && p_height == height && p_x == 0 && p_y == 0) {
		return;
	}
	uint8_t pdata[16]; 
	uint32_t pixel_size = get_format_pixel_size(format);
	Image dst(p_width, p_height, false, format);
	{
		const uint8_t *r = data.ptr();
		uint8_t *w = dst.data.ptrw();
		int m_h = p_y + p_height;
		int m_w = p_x + p_width;
		for (int y = p_y; y < m_h; y++) {
			for (int x = p_x; x < m_w; x++) {