When working with image processing on Linux systems, you might encounter this error:
bash: convert: command not found
This usually means the ImageMagick package, which provides the powerful convert
tool, isn't installed on your RedHat-based system.
For RedHat/CentOS systems, you have several installation options:
Using yum (RedHat/CentOS 7 and below)
sudo yum install ImageMagick ImageMagick-devel
Using dnf (RedHat/CentOS 8+)
sudo dnf install ImageMagick ImageMagick-devel
Verifying the Installation
After installation, verify it works:
convert --version
You should see output similar to:
Version: ImageMagick 6.9.10-68
Basic Image Conversion
convert input.jpg output.png
Resizing Images
convert input.jpg -resize 50% output.jpg
Batch Processing
for file in *.jpg; do convert "$file" -quality 85 "converted_${file}"; done
- If you get policy errors, edit
/etc/ImageMagick-6/policy.xml
- For missing delegates (like PNG support), install
libpng-devel
- Check dependencies with
ldd $(which convert)
If you need the latest version:
wget https://imagemagick.org/archive/ImageMagick.tar.gz
tar xvzf ImageMagick.tar.gz
cd ImageMagick-*
./configure
make
sudo make install
Remember to run sudo ldconfig
after installation.
The 'convert' command is part of the ImageMagick suite, a powerful toolkit for image manipulation. When you encounter the error "convert: command not found" on RedHat-based systems, it typically means either:
- ImageMagick isn't installed
- Only the newer 'magick' command is available (v7+)
- Required dependencies are missing
For RedHat/CentOS/Fedora systems, use these commands:
# Standard installation
sudo yum install ImageMagick
# For newer systems with dnf:
sudo dnf install ImageMagick
# To include development tools:
sudo yum install ImageMagick-devel
After installation, check the version and available commands:
convert --version
# or for ImageMagick 7+
magick --version
Here are practical examples of using convert:
# Convert JPEG to PNG
convert input.jpg output.png
# Resize image to 50% of original
convert input.jpg -resize 50% output.jpg
# Create thumbnail (200x200 pixels)
convert input.jpg -thumbnail 200x200 thumb.jpg
If you still encounter issues:
- Check your PATH:
which convert
- Verify file permissions
- Install missing delegates:
sudo yum install ImageMagick-jpeg ImageMagick-png
For systems with ImageMagick 7 where 'convert' was replaced by 'magick':
# Create symbolic link for compatibility
sudo ln -s /usr/bin/magick /usr/bin/convert