### ImageMagick version

7.1.0

### Operating system

Linux

### Operating system, version and so on

Actually any SO 

### Description

I was trying to create a new kernel for -morphology command. As described in the docs I was trying to use image2kernel perl script Anthony Thyssen wrote (https://imagemagick.org/Usage/scripts/image2kernel). After struggling a while, I discover 2 bugs in that code.
1) 
This split should have one more parameter:
my ($width, $height, $HERE, $depth, $type) = split(',', $');
(Probably it´s a version issue... old version should give 4  params instead of 5 when using txt:- to get pixel enumeration)

2) When using the -m parameter (make a simple morphological kernel), the following line is wrong:
$v = $v < $depth/2 ? '-' : '1'   if $MORPH;
it should be:
$v = $values{$c} < $depth/2 ? '-' : '1'   if $MORPH;

[image2kernel_v2.txt](https://github.com/ImageMagick/ImageMagick/files/13990762/image2kernel_v2.txt)


### Steps to Reproduce

To write a new kernel:
1) create a black and white gif image (black as background)
2) in a Linux SO, with Perl and ImageMagick 7.1 installed, run:
     perl image2kernel_v2 -gm image.gif kernel.dat
3) Using image2kernel_v2 (my modified version ) it will output a kernel.dat file.
4) To check its correct, run:
    magick xc: -define morphology:showkernel=1 -morphology dilate:0 @kernel.dat null:
if it does not show any error, it will show all the lines with its values.


### Images

_No response_
Perl script Image2Kernel bug
This is a GitHub Issue
repo:ImageMagick
owner:ImageMagick
Title : Perl script Image2Kernel bug
Issue date:

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

7.1.0

### Operating system

Linux

### Operating system, version and so on

Actually any SO 

### Description

I was trying to create a new kernel for -morphology command. As described in the docs I was trying to use image2kernel perl script Anthony Thyssen wrote (https://imagemagick.org/Usage/scripts/image2kernel). After struggling a while, I discover 2 bugs in that code.
1) 
This split should have one more parameter:
my ($width, $height, $HERE, $depth, $type) = split(',', $');
(Probably it´s a version issue... old version should give 4  params instead of 5 when using txt:- to get pixel enumeration)

2) When using the -m parameter (make a simple morphological kernel), the following line is wrong:
$v = $v < $depth/2 ? '-' : '1'   if $MORPH;
it should be:
$v = $values{$c} < $depth/2 ? '-' : '1'   if $MORPH;

[image2kernel_v2.txt](https://github.com/ImageMagick/ImageMagick/files/13990762/image2kernel_v2.txt)


### Steps to Reproduce

To write a new kernel:
1) create a black and white gif image (black as background)
2) in a Linux SO, with Perl and ImageMagick 7.1 installed, run:
     perl image2kernel_v2 -gm image.gif kernel.dat
3) Using image2kernel_v2 (my modified version ) it will output a kernel.dat file.
4) To check its correct, run:
    magick xc: -define morphology:showkernel=1 -morphology dilate:0 @kernel.dat null:
if it does not show any error, it will show all the lines with its values.


### Images

_No response_
--- end body ---
