You can add different parameters to extend the returned metadata, as described in the ImageMagick manual. Which will return the most basic metadata, but not the dpi. You can use ImageMagick to query the image metadata (data about the image): For printing the most common is usually 300 or 600 dpi (or somewhere in between). dpi does not really matter for the internet, as modern web-browser ignore the dpi setting, but traditionally web images have been set to 72 dpi. You can set, or change, that using ImageMagick. How big your fonts are going to become then depends on the dpi that your image is set to. Where the parameter points is the font size in dots per inch (dpi). $ convert -pointsize points -annotate +startx+starty "annotation" SrcImage.ext DstImage.ext To define the font size, add the function -pointsize before -annotation: $ convert -annotate +20+30 "My map" SrcImage.png DstImage.png Font size and dpi If you want to write “My map” in the upper left corner (20 pixels from the left and 30 pixels from the top) on a png file, this then becomes: Where startx is the image column where the text should start, starty is the row where to start, and the quoted text that follows ( annotation) is the text to write SrcImage and DstImage are the source and destination images, with ext denoting the image file type. $ convert -annotate +startx+starty "annotation" SrcImage.ext DstImage.ext The basic command-line syntax to -annotate an image using ImageMagick is: The blog uses -annotate as the vehicle for explaining how to put text in images, and then I describe how I used -draw to put the embossed watermark text on the maps at the top of each page, and -caption label -label for setting text in pre-defined geometries. The general options for setting fonts, colors and postions are similar. Which function to use depends on how much and what type of control you want to have over the text that is written. The ImageMagick functions -annotate, -draw, -caption and -label can all be used for writing text to images. If this happens, try to use the option +repage, and ImageMagick adjusts the canvas to fit the layer. A canvas can contain more than one layer, and the positions you are setting the text at might be in the canvas but outside the layer. If ImageMagick does not put the text as you expected (or not text at all), the chance is that your layer is not filling up the canvas. The previous post is an introduction to ImageMagick. This post only covers how to use ImageImagick for putting text in images, and to create image compositions. This can not be done manually, and I chose to use ImageMagick. I also wanted to create animations from time-series of maps, and put both a caption, a time line and a clock in the image.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |