### ImageMagick version

7.1.1-6

### Operating system

Linux

### Operating system, version and so on

Fedora 37

### Description

Hinting the format in `image_info->magick` doesn't work when loading from a file. For example, when loading a NEF image and initializing `image_info->magick` to `"NEF"` the image appears to load via the TIFF loader (see reproducer below).

Reverting commit 6f7cebf3fceb41ada062fb782a259db82644dc39 seems to fix this.
```diff
--- a/MagickCore/image.c
+++ b/MagickCore/image.c
@@ -2855,8 +2855,7 @@ MagickExport MagickBooleanType SetImageInfo(ImageInfo *image_info,
         }
     }
   *component='\0';
-  if (*image_info->magick == '\0')
-    GetPathComponent(image_info->filename,ExtensionPath,component);
+  GetPathComponent(image_info->filename,ExtensionPath,component);
   if (*component != '\0')
     {
       /*
```
(This corresponds to commit https://github.com/ImageMagick/ImageMagick6/commit/2cf7bfe4fbcd51025467934b4bccb50511654509 in ImageMagick 6.x)

### Steps to Reproduce

```c
/* Compile with:
 * gcc -g -Wall test-nef.c `pkg-config MagickCore --cflags --libs` -o test-nef
 *
 * Run with:
 * ./test-nef _DSC4175.NEF
 *
 * Expected output: 4284x2844
 * Actual output: 160x120
 */
#include <stdio.h>
#include <assert.h>

#include <MagickCore/MagickCore.h>

int
main(int argc, char **argv)
{
	ExceptionInfo
		*exception;

	Image
		*image;

	ImageInfo
		*image_info;

	if (argc != 2) {
		printf("Usage: %s image\n", argv[0]);
		return 1;
	}

	MagickCoreGenesis(*argv, MagickTrue);
	image_info = AcquireImageInfo();
	(void) CopyMagickString(image_info->filename, argv[1], MaxTextExtent);
	(void) CopyMagickString(image_info->magick, "NEF", MaxTextExtent);
	exception = AcquireExceptionInfo();
	image = ReadImage(image_info, exception);

	assert(image);
	printf("%ldx%ld\n", image->columns, image->rows);

	image = DestroyImage(image);
	exception = DestroyExceptionInfo(exception);
	image_info = DestroyImageInfo(image_info);
	MagickCoreTerminus();

	return 0;
}
```

### Images

[_DSC4175.zip](https://github.com/ImageMagick/ImageMagick/files/11183065/_DSC4175.zip)
Format hint in `image_info->magick` doesn't work when loading from file
This is a GitHub Issue
repo:ImageMagick
owner:ImageMagick
Title : Format hint in `image_info->magick` doesn't work when loading from file
Issue date:

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

7.1.1-6

### Operating system

Linux

### Operating system, version and so on

Fedora 37

### Description

Hinting the format in `image_info->magick` doesn't work when loading from a file. For example, when loading a NEF image and initializing `image_info->magick` to `"NEF"` the image appears to load via the TIFF loader (see reproducer below).

Reverting commit 6f7cebf3fceb41ada062fb782a259db82644dc39 seems to fix this.
```diff
--- a/MagickCore/image.c
+++ b/MagickCore/image.c
@@ -2855,8 +2855,7 @@ MagickExport MagickBooleanType SetImageInfo(ImageInfo *image_info,
         }
     }
   *component='\0';
-  if (*image_info->magick == '\0')
-    GetPathComponent(image_info->filename,ExtensionPath,component);
+  GetPathComponent(image_info->filename,ExtensionPath,component);
   if (*component != '\0')
     {
       /*
```
(This corresponds to commit https://github.com/ImageMagick/ImageMagick6/commit/2cf7bfe4fbcd51025467934b4bccb50511654509 in ImageMagick 6.x)

### Steps to Reproduce

```c
/* Compile with:
 * gcc -g -Wall test-nef.c `pkg-config MagickCore --cflags --libs` -o test-nef
 *
 * Run with:
 * ./test-nef _DSC4175.NEF
 *
 * Expected output: 4284x2844
 * Actual output: 160x120
 */
#include <stdio.h>
#include <assert.h>

#include <MagickCore/MagickCore.h>

int
main(int argc, char **argv)
{
	ExceptionInfo
		*exception;

	Image
		*image;

	ImageInfo
		*image_info;

	if (argc != 2) {
		printf("Usage: %s image\n", argv[0]);
		return 1;
	}

	MagickCoreGenesis(*argv, MagickTrue);
	image_info = AcquireImageInfo();
	(void) CopyMagickString(image_info->filename, argv[1], MaxTextExtent);
	(void) CopyMagickString(image_info->magick, "NEF", MaxTextExtent);
	exception = AcquireExceptionInfo();
	image = ReadImage(image_info, exception);

	assert(image);
	printf("%ldx%ld\n", image->columns, image->rows);

	image = DestroyImage(image);
	exception = DestroyExceptionInfo(exception);
	image_info = DestroyImageInfo(image_info);
	MagickCoreTerminus();

	return 0;
}
```

### Images

[_DSC4175.zip](https://github.com/ImageMagick/ImageMagick/files/11183065/_DSC4175.zip)
--- end body ---
