### ImageMagick version

7.1.1-21

### Operating system

MacOS

### Operating system, version and so on

macOS 14.1.2

### Description

Exporting JPEG2000 images in YUV colorspace is generally broken and unusable as it either produces corrupted images or crashes the app.

Also, the [jp2 encoder](https://github.com/ImageMagick/ImageMagick/blob/da099f2d2f62613644a942a8369bf986d9bfdf09/coders/jp2.c#L1043) is parsing a "-sampling-factor" option as "1:1" rather than "1x1" as specified in the documentation.

### Steps to Reproduce

Crash:
```sh
convert logo: -resize 5000x5000 -colorspace YUV logo.jp2
```
Corrupted image:
```sh
convert logo: -colorspace YUV -sampling-factor 2:2 logo.jp2
```

Non-decodeable image:
```sh
convert logo: -colorspace YUV logo.jp2
```

### Images

_No response_
JPEG2000 encoder crashes with YUV colorspace images
This is a GitHub Issue
repo:ImageMagick
owner:ImageMagick
Title : JPEG2000 encoder crashes with YUV colorspace images
Issue date:

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

7.1.1-21

### Operating system

MacOS

### Operating system, version and so on

macOS 14.1.2

### Description

Exporting JPEG2000 images in YUV colorspace is generally broken and unusable as it either produces corrupted images or crashes the app.

Also, the [jp2 encoder](https://github.com/ImageMagick/ImageMagick/blob/da099f2d2f62613644a942a8369bf986d9bfdf09/coders/jp2.c#L1043) is parsing a "-sampling-factor" option as "1:1" rather than "1x1" as specified in the documentation.

### Steps to Reproduce

Crash:
```sh
convert logo: -resize 5000x5000 -colorspace YUV logo.jp2
```
Corrupted image:
```sh
convert logo: -colorspace YUV -sampling-factor 2:2 logo.jp2
```

Non-decodeable image:
```sh
convert logo: -colorspace YUV logo.jp2
```

### Images

_No response_
--- end body ---

The JPEG2000 encoder in ImageMagick v7.1.1-21 has a vulnerability that causes crashes when processing images in YUV colorspace, leading to potential Denial of Service (DoS) conditions. The encoder fails to handle certain inputs correctly, resulting in application crashes or corrupted outputs.