- 1 year ago
convert and mogrify: The correct way to use them in modern versions of ImageMagick
In modern versions of ImageMagick, the convert
command has been replaced with the more versatile magick
command, and the mogrify
command is still available for in-place image modifications. Here's how you can use them:
magick
command (replacingconvert
):
Themagick
command is used for various image manipulation tasks, such as converting, resizing, cropping, and applying effects. Here's an example of how to use it to convert an image format:luamagick input.jpg output.png
This command converts
input.jpg
tooutput.png
.You can find more options and functionalities of the
magick
command in the official ImageMagick documentation.mogrify
command:
Themogrify
command is used to modify images in-place, meaning it directly modifies the source image without creating a new output file. Here's an example of how to use it to resize an image:cssmogrify -resize 800x600 input.jpg
This command resizes
input.jpg
to 800x600 pixels, overwriting the original image.Note: Be cautious when using
mogrify
as it modifies the source file irreversibly. Make sure to have backups of your images before usingmogrify
.
Both the magick
and mogrify
commands provide a wide range of options and parameters for different image manipulation tasks. You can refer to the ImageMagick documentation or use the --help
flag with the commands to explore their features and syntax.
It's worth noting that the commands and options available may vary slightly depending on the version of ImageMagick you have installed. Therefore, it's a good practice to consult the documentation or specific resources for the version you are using.