Make sure to end the whole argument with a closing single quote. Finally, you put the caption in double quotes. If you put a coordinate that is larger than either dimension, the text won't show up. You then put put the horizontal and vertical coordinates of where you want to the text to start. After -draw you start the argument with a single quote. The -draw argument has to be treated carefully. ![]() If you enter the command "showrgb", you will see the long list of color names available (isn't Linux great?). Here is a command that produces sunset2.jpg: convert -pointsize 20 -fill yellow -draw 'text 270,460 "Sunset over the Nile" ' sunset1.jpg sunset2.jpg Note: -pointsize 20: this is the size of the letter (there are 72 points per inch) -fill yellow: this is the fill color of the text -draw 'text 270,460 "Sunset over the Nile" ': start 270 pixels from the left and 460 pixels from the top sunset1.jpg sunset2.jpg: using the first file as a starting point, write out to the second file There is a wide range of color names that you can specify. We will use this information to determine where we want to place the caption. That means that it is 640 pixels wide and 480 pixels tall. I used another capability of the "convert" command to resize it a smaller version for this instructable. The original image is a scaled down version of a much larger image that was a 7 megapixel image. I will keep the original image in place and save changes to new filenames for safety sake. ![]() This is a photo that I took on a recent trip to Egypt and Jordan (You can see all the photos at ). My original image will be a file called sunset1.jpg. A more complete description of the convert command can be found at: For our purposes, we only want to use the "-draw" argument to write the caption to the photo. If you issue the bare command "convert" you can see that it is a very powerful tool with many capabilities. If it is not there, you will see "convert: command not found". If it is there, a long description of the command will be printed out with all the options available. Another way to find out if it is available, just issue the command "convert" at the command line. If it is available, its location will be printed to the screen. One way to do this is to issue the command "which convert". You also want to make sure that the convert command is available on your system. In my case, I want to work with a file called "sunset1.jpg". Issue the comman "ls" to see what files are there. To get to that subdirectory, type "cd images". Let's assume that the image you want to play with is in an "images" subdirectory. A window will open up with a command line prompt. With Ubuntu Linux, you do this by selecting Applications->Terminal. First of all, bring up a terminal window. Windows calls this a command window but it is rarely used in Windows except by oldtimers who remember it from the DOS days. To perform the task of adding a label to an image, we will be working entirely within a Linux terminal window. Also, so far, it is invulnerable to viruses. BTW, Linux is FREE, along with everything available to it. You can turn your computer into a dual-boot machine (I'd really recommend that you install a second hard disk in your machine - any size will do). I may write an instructable on how to do this at a later date but if you want to pursue this on your own, you can go to and start the process. If you are a Windows user and are still tempted to read this instructable, you may be tempted to download and install Linux. I'm not aware of a utility such as convert in Microsoft Windows but who ever does anything with a command line in Windows? This instructable is more aimed at Linux users who want to get more out of their computer. The major catch with this instructable is that you have to do all this in the Linux operating system. This instructable will show you how to do all this. ![]() You can choose the starting point for the text (via a height/width coordinate), the fill color of the text, the point size of the text, and the font used. There are many convert options that you can make use of in placing text on the image. Another use would be the placing of a time stamp on an image that gets generated automatically by a webcam. One valuable use of this is the placing of a caption on an image for documentation. This instructable will show you how to add text to an image using the convert command in Linux.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |