11/11/2023 0 Comments Brew imagemagic update![]() ![]() To set a black border width of 2 pixels on all sides, give HEX code = "#000000", interpreted as no red, no green and no blue, and then the ImageMagick command for setting the borders (png file type): ( is also a generally useful resource for learning html and how to build web-pages). The site gives a short introduction to HEX colors, including a tool for color picking. HEX-code is a standardized hexadecimal system for setting colors as “#RRGGBB”. Where sidewidth is the border width at the sides, topbottomwidth the width at the top and bottom, and quoted HEXcode the color code. $ convert -border sidewidthxtopbottomwidth -bordercolor "HEXcode" SrcImage.ext pub-images/DstImage.ext If you want to have a border on your images, you have to give two ImageMagick parameters -border and -bordercolor: You can always use $ mogrify instead of $ convert, but below I will use $ convert. If you do not add any other ImageMagick function, $ mogrify will simply create a copy of SrcImage.ext (where ext is the file format extension). ![]() If you want to keep the name of your image after ImageMagick manipulations, you can use $ mogrify instead of $ convert, but you have to give the -path while skipping the DstImage parameter: $ convert -quality 70 SrcImage.png pub-images/DstImage.jpg Keeping the image format and name All the maps at the top of Karttur´s pages are jpg files, with quality set to approximately 70 %: $ convert SrcImage.png pub-images/DstImage.jpgĪs the map images I use at the top of each page are rather large, I wanted to reduce the file size (without changing image dimensions), which I can do using the quality function. If you want to change from, say png to jpg, the command to write in the Terminal is simply: To change the file type, simply give the desired file type extension in the DstImage. For changing the image format you only need to state the the source image SrcImage and the destination file where to save the new image, DstImage. All image manipulations require some parameters, except for changing the image format. The basic command for executing ImageMagick is $ convert. The the Terminal thus correctly interprets "my folder" and "how to tame a lion.jpg". To avoid this you must quote folders and files that contain blanks. my folder) or your file name contains blanks (how to tame a lion.jpg), the Terminal will not be able to interpret the “commands” my, folder, how, to, tame (lion.jpg might be understood as an image, but one that does not exist). Thus, if your folder name contains blanks (e.g. The Terminal command-line interprets all blanks as separators. If the sub-folder does not exists the ImageMagick functions will not work. The syntax in the examples below produces images that are saved in a subfolder pub-images. Make a new director (mkdir), it will be created as a sub-directory under the present Terminal directory: ![]() You can also just write $ cd at the command-line and drag the path from a Finder window. Start a Terminal session, and go to the directory where you have the images you want to work with. Then reinstall the newer version, or install with added commands if requested. ![]() If you need to remove a Homebrew installed app, use the command remove: But this was changed and is no longer required (or even possible). With older versions of Brew you had to add vector processing for ImageMagick with the command: $ brew install imagemagick –with-librsvg. Then install ImageMagick from the Terminal command-line: Start a Terminal session, and update Homebrew before installing any app to make sure you get the latest version. If you want to use Homebrew, please visit the Homebrew site and install Homebrew. Homebrew is package manager for macOS (other alternatives include MacPorts and Fink, but I prefer Homebrew). I use Homebrew, for installing ImageMagick, but you can also go to ImageMagick Download page and follow the installation instructions. This post focuses on using ImageMagick for batch processing, and describes how I use ImageMagick for editing the maps at the top of Karttur´s GitHib pages. The official homepage, as well as many other blogs, have excellent tutorials and cheatsheets for how to use ImageMagick. In this blog I will only briefly introduce ImageMagick for macOS. The ImageMagic site lists other options than the command-line for accessing the image manipulation functions. ImageMagick is a command-line ( Terminal) tool for creating, editing, composing, and converting images. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |