Before installing any software, it is recommended to update your system to ensure you have the latest package information. Open Terminal and run the an appropriate command depending on your Linux distribution:
Fo Ubuntu Linux:
- sudo apt-get update
For RHEL (Red Hat Enterprise Linux), CentOS, and Fedora systems:
- sudo dnf update
For Arch Linux:
- pacman -Syy
Install ImageMagick if it is not already installed on your system
- For Ubuntu or Debian:
- sudo apt-get install imagemagick
- For RHEL, CentOS or Fedora:
- sudo yum install imagemagick or
- sudo dnf install ImageMagick
- For Arch Linux:
- sudo pacman -S imagemagick
To confirm that ImageMagick has been installed successfully:
- magick -version
Add Text to Image
Open the terminal and navigate to the directory where the image is located. Use the convert command followed by the image filename to apply text:
- convert original_image.jpg -gravity location -pointsize fontsize -fill color -annotate +X_offset+Y_offset "text" modified_image.jpg
You can adjust the font, color, and position of your text by modifying the command parameters. For example, you can use a different font by adding the -font parameter:
- convert original_image.jpg -gravity location -pointsize fontsize -font Times-Roman -fill color -annotate +X_offset+Y_offset "text" modified_image.jpg
- original_image.jpg: Replace it with the actual image filename.
- gravity location: Specifies the position to anchor the text (e.g., NorthWest, Center, South).
- fill: Specifies the color of the text.
- annotate: is the position of the text.
- pointsize fontsize: Determines the size of the text.
- +X_offset+Y_offset: Sets the X and Y offsets in pixels. It indicates the X and Y coordinates of the text relative to the top left corner of the image.
- "text": Replace it with the desired text.
- modified_image.jpg: Replace it with the desired output image filename.
- convert original_image.png -gravity SouthEast -pointsize 36 -font Times-Roman -fill darkblue -annotate +50+50 "www.tssfl.com" photo_with_text.jpg
Note: You can experiment with different options to achieve the desired look and feel for the added text.
See attached example of the original and the annotated images.