一直耳鸣是什么原因引起的| 什么自行车最贵| 冬虫夏草有什么功效与作用| 公众号是什么意思| 纸尿裤nb是什么码| 金达克宁和达克宁有什么区别| 香港身份证有什么好处| 痔疮很痒是什么原因| 血小板平均体积偏高是什么意思| 梦见小女孩是什么意思| 属猪男配什么属相最好| 撤退性出血是什么颜色| 存是什么生肖| 什么样的梦想| ca199是什么检查项目| 为什么遗精| 吃什么补心| 克服是什么意思| 89年的蛇是什么命| 狗为什么不吃饭| 土是念什么| 为什么奢侈品都是pvc| 上网是什么意思| 失足妇女是什么意思| 男人梦见鱼是什么征兆| 射手座是什么星座| 五月二十是什么星座| 望闻问切的闻是什么意思| 左眼跳什么意思| 厚黑学什么意思| 离职原因写什么| 为什么头皮会疼| 南瓜子有什么功效| 八0年属什么生肖| 横梁是什么| 竹笋不能和什么一起吃| 印度以什么人种为主| 周围神经炎是什么症状| 西红柿拌白糖又叫什么| 日本兵为什么不怕死| 反流性食管炎是什么症状| 晨尿茶色是什么原因| 一路长虹是什么意思| 2.7是什么星座| 杨柳是什么生肖| 白细胞低是什么原因| 侏罗纪是什么意思| 彩宝是什么| 强烈的什么| 包含是什么意思| sany是什么牌子| 趴在桌子上睡觉有什么坏处| 印度为什么叫三哥| 燕窝是什么东西| 中性粒细胞低吃什么药| 日益是什么意思| 小巴西龟吃什么食物| 冻顶乌龙茶是什么茶| 撸铁什么意思| 竹肠是什么部位| 什么是还原糖| 市长是什么级别| 脚酸臭是什么原因| 费力不讨好是什么生肖| 四不像是指什么动物| 一什么乌云| 脚趾长痣代表什么意思| 人加一笔变成什么字| 头发染什么颜色显皮肤白显年轻| 叶酸是什么东西| 什么的小学生| 孕妇吃什么鱼对胎儿好| 黄瓜生吃有什么好处| 盆腔镜检查是查什么的| 三摩地是什么意思| 忙碌的动物是什么生肖| 九寨沟什么时候去最好| 女性胆囊炎有什么症状| 体内湿气重吃什么药效果好| 胃糜烂有什么症状| 念珠菌用什么药| 右大腿上部疼痛是什么原因| 泌尿科挂什么科| 春分是什么意思| 子宫内膜病变有什么症状| 痞闷什么意思| 乳房痛是什么原因| 小脑萎缩吃什么药好| 9月29是什么星座| 鱼刺卡喉咙去医院挂什么科| 肠系膜淋巴结炎吃什么药最有效| 流金是什么字| 福兮祸兮是什么意思| 6月7号什么星座| 为什么打嗝| 什么是云| 树懒是什么动物| 米杏色是什么颜色| 蜜蜂怕什么| 零度是什么意思| 赞赏是什么意思| lino是什么面料| 卡姿兰是什么档次| 倒数是什么意思| ikbc是什么牌子| 鸟喙是什么意思| 抗体是什么意思| 卯时五行属什么| 民警是干什么的| 低压偏高有什么危害| 霞字五行属什么| 碧潭飘雪是什么茶| 血止不住是什么原因| 风起云涌是什么生肖| 宝五行属什么| 女性阴部痒是什么原因| 76年属什么生肖| 相识是什么意思| 娇嫩的意思是什么| 吃什么药能让月经推迟| 荷花什么时候开放| 138是什么意思啊| 肠癌是什么症状| 什么是伤官| 韭菜有什么功效| 不良于行是什么意思| 低脂高钙牛奶适合什么人群| kiss什么意思| 什么是骨质增生| 甲状腺是什么科| 艺字五行属什么| 读军校需要什么条件| 新茶是什么意思| 膨鱼鳃用什么搭配煲汤| 做噩梦是什么原因| 35年属什么生肖| 痛风什么蔬菜不能吃| 无可奈何什么意思| 老婆生日送什么鲜花| 肠功能紊乱吃什么药| 人是什么生物| 1968属什么生肖| 羊奶不能和什么一起吃| 喝酒后胃疼吃什么药| 过敏性鼻炎吃什么药好的快| 庆大霉素治疗鱼什么病| 祈禳是什么意思| 父亲节送什么好| 什么争鸣成语| 色丁布是什么面料| 水绿色是什么颜色| 顺遂是什么意思| 舒化奶适合什么人喝| 什么是牙冠| 脑子萎缩是什么原因造成的| crp医学上是什么意思| 夏天有什么植物| 酒精肝吃什么药| 牙齿痛吃什么| 老公生日送什么礼物好最合适| 心脏早搏是什么原因造成的| 脾虚湿蕴证是什么意思| 心脏支架和搭桥有什么区别| 你的美丽让你带走是什么歌| 想吐头晕是什么原因| 啪啪啪是什么意思| 吃什么食物补阳气| 安然无恙是什么意思| 举足轻重是什么生肖| 装牙套有什么坏处| 马跟什么相冲| 绿字五行属什么| 天使什么意思| 肺结节钙化是什么意思| 糖尿病人能吃什么| 祭奠用什么花| 宁静致远什么意思| 癫痫挂什么科| 妊娠什么意思| 执业药师证有什么用| 舌头白色的是什么原因| 可拉明又叫什么| 一冷就咳嗽是什么原因| 痱子粉和爽身粉有什么区别| 专著是什么| 腹部胀痛什么原因| 女人物质是什么意思| 人天是什么意思| bacon是什么意思| 狮子头是什么肉| 什么卫什么海| 眼睛干涩是什么原因| 呼吸衰竭是什么意思| 蓝五行属什么| 嘴皮发白是什么原因| 内分泌失调吃什么| 猪和什么生肖最配| 胃不消化吃什么药效果最好| 嬴政为什么要杀吕不韦| 长红痣是什么原因| 什么样的小溪| 高危型hpv有什么症状| 8月13号什么星座| 亲戚是什么意思| 气罐和火罐有什么区别| 周瑜是一个什么样的人| 为什么睡觉会出汗| 玫瑰茄和洛神花有什么区别吗| 脑科属于什么科| 什么是紫苏| 时光荏苒是什么意思| 甯是什么意思| vodka是什么酒| 护理主要学什么| mc什么意思| g18k金是什么意思| 行政助理是干什么的| 蝎子长什么样| 掉头发是什么原因| 秦皇岛为什么叫秦皇岛| 蛋白烫发是什么意思| 绿豆汤放什么糖| 头发少适合什么发型| 花骨朵是什么意思| 腹胀便溏是什么意思| 推迟月经用什么药| logo是什么| 为什么会得灰指甲| 心包隐窝是什么意思| cma检测是什么| 喉咙疼吃什么药| 月经不调吃什么药调理最好| 巧克力有什么功效与作用| 副研究员什么级别| 明胶是什么| 精液是什么颜色的| 八九年属什么| 木槿是什么意思| 痔疮是什么原因引起| 拍花子是什么意思| 百草霜是什么| 二月二十五号是什么星座| 三尖瓣轻度反流说明什么| 吐鲁番为什么那么热| 直径是什么| 腰间盘膨出吃什么药效果好| b2c什么意思| wz是什么意思| 蟑螂喜欢吃什么| 肾阴虚吃什么食物最好| 家里来猫是什么征兆| ken是什么意思| 然五行属什么| 腹水是什么病| 女生安全期是什么意思| 做试管前需要检查什么项目| 宰相相当于现在的什么官| sls是什么化学成分| 孕妇白细胞高是什么原因| 末梢神经炎是什么症状| 猫的祖先是什么动物| 什么叫腔梗| 过期牛奶可以做什么| 精液带血是什么原因| 百度

Examples of ImageMagick Usage
ImageMagick Version 7

These web pages presents a set of examples using ImageMagick ("IM," for short), version 7, from the command line. However, they often have direct analogs in the legacy release of ImageMagick, version 6. They also illustrate what can be done using the ImageMagick Application Programming Interface (API). As such, these pages should be the first stop for IM users after reading the terse Command Line (CLI) Option manuals.

Often, the same questions of "How do I..." gets asked, over and over again on the network. The examples in these web pages, I hope, will answer most of the common "how-to" questions that arise.

 
[IM Logo]
[IM Version]
Download PageCentOS RPM,
Linux SRPMBeta Release
Discussion Server
Other related sites...
 
Fred's ImageMagick Scripts
RubbleWebs, PHP using IM CLI
Snibgo's ImageMagick pages
 
Main ImageMagick Web Site
 -----   Practical Examples    -----
 Basic Usage
Basic command and image handling
 Image File Handling
Reading and writing images
 Common Image Formats
Handling GIF, JPEG, and PNG images
 Text to Image Handling
Converting text into images
 Compound Font Effects
Font drawing styles and techniques
 Annotating Images
Labeling and overlaying images
 Thumbnails and Framing
Small reference images of large photos
 Photo Handling
Modifying photographs
 Lens Correction
Correcting photo distortions
 Montage, Arrays of Images
Image indexes and arrays
 Layers of Multiple Images
Combining multiple images together
 Animation Basics
Creation and study of animations
 Animation Optimization
Making GIF animations smaller
 Animation Modifications
Changing and merging animations
 Video Handling
Handling real life video images
 Image Comparing
Comparing two or more images
 Advanced Techniques
Complex manipulations of images
 Background Examples
Examples of creating random backgrounds
 
 Repositories Links
Links to other IM scripts and info
 Reference Index
Quick index for specific options
 Support Scripts
Shell scripts used by examples
 -----   Basic Techniques    -----
 Canvas Creation
Creating canvas and background images
 Color Basics and Channels
Low level color handling
 Color Modifications
General color changes
 Masking and Background Removal
Alpha channel, and transparency handling
 Color Quantization and Dithering
Reducing the number of colors
 Cutting and Bordering
Slicing, dicing, framing, trimming
 Resizing or Scaling
Enlarging and shrinking images
 Resampling Filters
Controlling image resizing
 Compositing Images
Overlaying and merging two images
 Drawing on Images
Vector graphics, MVG and SVG images
 Simple Image Warping
Flipping, rotating, twisting
 Distorting Images
Carnival house of mirrors
 Image Transformations
Drastic changes to the look of an image
 Image Mapping Effects
Lens, glass and ripple effects
 Blurring and Sharpening Images
Blurring, sharpening and shadows
 Morphology of Shapes
Using pixel neighbourhoods
 Convolution of Images
Weighted averaged neighbourhoods
 Fourier Transforms
Modifying images in the frequency domain
 Anti-Aliasing
Anti-aliasing effects and problems
 Miscellaneous
Bits and pieces
 APIs, Scripting, Building
Usage in other environments
 Usage under Windows
IM on Windows PC
 Development and Bugs
Development proposals and bugs, new and old
Legend for symbols used within example pages...
Hint, tips or extra info For more advanced users Older version warnings
Test Image Storage Directories...   Small Images (image display),     Photographs (fancy index).

ImageMagick Examples - Introductory Notes

What is ImageMagick? A No-Holds-Barred Summary

ImageMagick is designed for batch processing of images. That is, it allows you to combine image processing operations in a script (shell, DOS, Perl, PHP, etc.) so the operations can be applied to many images, or as a sub-system of some other tool, such as a Web application, video processing tool, panorama generator, etc. It is not a GUI image editor.

ImageMagick is, first of all, an image-to-image converter. That is what it was originally designed to do. That is, it will convert an image in just about any image format (tell us if it can't) to any other image format.

But it is also a library of image processing algorithms. These can be access via the command line and shell/DOS scripts (which these example pages demonstrate), or via a large number of programming languages, such as C, C++, Perl, Ruby, PHP, etc. See: ImageMagick APIs.

Speed was never a major feature of IM, which places more emphasis on the quality of the images it generates. That is not to say that it can't transform images in a reasonable amount of time. It's just not blindingly fast. Because of this, IM can be slow to perform certain processing operations, especially when attempting to compress images into image formats that have limited capabilities.

ImageMagick concerns itself mainly with images in the form of a rectangular array of pixels, commonly called a "raster." It will handle "vector" image formats like Postscript or PDF, but at the cost of converting those images into a raster when loading them, and generating a vector image wrapper around the raster when saving it. As a result, vector images are often processed badly when using the default settings. However, specific options can be used to improve this situation. See: A word about vector image formats.

About These Examples of ImageMagick Usage

These pages were developed from, and are a continuation of, my Collection of ImageMagick Hints and Tips page I first started in 1993, and placed on the new fangled world-wide-web making its appearance around the same time. Information on many aspects of IM, and notes not included in these pages, are still present in that document. However, while the present pages were designed for you to look at, the hints and tips document was only for my own edification. So, it may be vague or chaotic in places. You are welcome to look at it, learn, and make comments on it.

Other examples were grabbed or developed from answers to users' questions on he IM Forums, or contributed to me as solutions to various problems.

I look forward to suggestions and e-mail from other IM users. Such e-mail generally results in improvements and expansions to these example pages.

Command Line Environments

All examples are written for use on UNIX, and specifically GNU/Linux systems, using BASH scripting. As a consequence, some examples use shell 'for-do' loops. Most examples use a backslash '\' at the end of a line to continue that command on the next line. The longer commands are broken into separate lines to try to further highlight the steps being applied.

However, you can still use these examples from PC Windows batch scripts, with some changes to the handling of certain characters. With some slight adaptation, the examples can also be run directly from 'system' calls in PHP scripts.

See Windows Usage and APIs and Scripting for more information on using the ImageMagick commands in these alternative environments. Contributions and test examples are welcome.

PerlMagick, and Other APIs

It should also be possible to adapt any of these examples to use the IM API from languages such as Perl, C, C++, Ruby, PHP, and so on. I recommend trying things out on the command line first, until you get them right, and then converting the operations to the specific API you are using.

Although the situation has improved enormously with IM version 6, the command line really only deals with a single image sequence at any one time. However, APIs do not have this limitation, and allow you to manipulate multiple image sequences, separately or together, to perform more complex operations. This ability makes it simpler to implement these examples using the IM API, and removes the need to save images as temporary files, as many of the command line examples require. When using an API, only permanent and semi-permanent images need be saved to disk.

Basically, let the example pages give you a start, to let you see what is possible with ImageMagick. Then, formulate what you want to do on the command line, before coding the operations in scripts and API code, where it is harder to make extensive changes.

I also recommend that you comment your API code, heavily, adding the command line equivalents to what you are trying to do, if possible. That way, you can check and compare the results against those using the command line. This lets you debug problems that you may come across later, especially as improvements are made to image processing in the Core ImageMagick Library.

Downloading Input Images and Results

As much as possible, I try to use images built-into IM (such as "logo:" or "rose:") as input images for IM example commands, or to generate input images using IM commands. I also often re-use the output of previous commands in later examples. Because of this, you usually don't need to download any 'test' images in order to try out the examples yourself.

However, such generated or built-in images are not always convenient. So, when I do use an external image, I tend to re-use that input image, or the results of previous examples, for later examples in that section.

Sometimes the original source image will be displayed or for larger images a link to the source image is provided. More commonly only the final resulting image will be shown, as the input is well known or obvious.

Almost all the IM example commands shown are executed in the same web directory in which they appear. That is, the command you see is the command that was actually used to generate the image. Because of this you can modify the page's URL to download or view the input image(s) used by an example. Extra copies of the external source images have also been placed in the "images" and "img_photos" sub-directories. See also the example of a Fancy Photo Index of those images.

If text output or image information is produced by an example, it is saved to a text file, and an image of it is generated for display on the Web page. Selecting the text output image will link you to a copy of the actual text output by the command.

In all these examples, selecting the output image should let you download the image which was actually created by the example command. But be warned, not all browsers understand all image formats used.

External Image Sources

By the way, most of the source images used in these examples come from Anthony's Icon Library, particularly the background tiles, large clip-art, and dragons sections of the library. (I like dragons!). ASIDE: these pages may be offline as the web site slowly moves to a new server.

This library actually predates the WWW. I created it in 1991, due to the lack of good, clean iconic images for use on the X Window System. The advent of the WWW has of course changed this, but my original library still exists and remains available as a source of images, even though it is not actively growing.

Some specific images, and larger images, are contributed by the authors of specific examples. The authors of such examples are listed in the contributed section, or at the bottom of the page.

If you are looking for a specific image, I recommend using Google Image Search (or similar) to find something appropriate. You can, of course, convert or resize such images using IM for your own purposes. However, you should be careful about copyright if you plan to use such images commercially.

PNG Images on Web Pages

[IM Output]

In many examples, I use an image in PNG format, such as that shown to the right of this text. The PNG image format supports images with semi-transparent pixels, a feature few other image formats provide. It is also a very well-understood image format and, as such, is usable by most of today's image programs and Web browsers.

Some Web browsers, however, do NOT handle transparent PNG images correctly (most notably Microsoft Internet Explorer v6). Because of this, I generally use the JPEG and GIF formats for images on the Web, and only use the PNG format when generating images with semi-transparent pixels, or when exact colors are needed for later examples.

To allow IE v6 browsers to display PNG images, I use a special 'style sheet' using complex JavaScript. For information on this, see PNG with transparency for IE. Technically, this is only problem with IE, not ImageMagick.

Displaying Images on Your Screen

Display problems can also occur when displaying images on-screen. Because of this, I recommend using a command like the following to tile a 'checkerboard' pattern underneath the image, to highlight any transparent or semi-transparent pixels in it.

   magick composite -compose Dst_Over -tile pattern:checkerboard image.png x:
[IM Output]

The image displayed in the above example is a special PNG-format test image, which was generated using a shell script. Normally, the command would output the results to your display, not onto a Web page like this.

If you look carefully, you can see the checkerboard pattern though the semi-transparent colors. However, the image, as a whole, is fully opaque. So, this technique should work on all displays, Web browsers, and image viewers.

As of IM v6.0.2, the "magick display" program performs something like this automatically. However, it does not seem to handle images using color tables (i.e., GIF) in this way. Using the "x:" output image format (as above) causes an image to be displayed directly to the screen, without having to save it. See Show Output Display for more information.

Font Usage

The fonts I use in these examples are from a small collection of TrueType fonts I have found over the years, and saved for my own use. Some of these are under copyright, so I cannot publish them online.

You are, however, welcome to substitute other fonts that you have available. The examples should work (perhaps with some changes to image size) with any appropriate font you have available on your system. Microsoft "Arial" font, or even "Times-BoldItalic", should work on most systems.

To see what fonts are currently available to your version of IM, run the following command...

   magick -list font

WARNING: If the font requested is not found, ImageMagick used to silently substitute a default font, typically Arial or Times. It still does this, but a warning is now given. So, test the font beforehand, to make sure that it is the one you want, and not the default font.

On my Linux system, I use a special Perl script, "imagick_type_gen", to generate a file, "type.xml", saved in the ".magick" sub-directory of my home directory. ImageMagick uses that file, which contains a font list in XML format, to find fonts. The script "locate"s (run "updatedb" first, if you have just added new fonts), and describes all the fonts available on my system. With this setup, I only need to specify the name of the font I want to use, and not the full path to a specific font file.

For example...
   # Instead of using the command...
   magick -font $HOME/lib/font/truetype/favorite/candice.ttf \
           -pointsize 72 label:Anthony  anthony.gif

   # I can use the simpler font label...
   magick -font Candice -pointsize 72 label:Anthony  anthony.gif
Before IM v6.1.2-3, the "type.xml" file was named "type.mgk". If you are using an earlier version of IM.

The fonts used in these IM examples are listed in a Montage of Example Fonts Example. My personal favorite is Candice, so it gets used quite a bit.

If you also like the 'Candice' font, or any of the other fonts I use, grab them from Free Fonts or 1001 Fonts .com.

Example Page Updates

These example pages are in an on-going cycle of improvement. Generally, I find I stop adding to these pages for long periods of time, when my interests become focused on other things.

Often these examples are re-built using the latest beta release of IM, allowing me to see changes and bugs that may appear in each version of IM, before it is generally released. However, the example images shown are what the given IM command produces on my system. If you get something different, your IM is probably a much older version (with old bugs), or is not correctly installed.

Note that e-mailing me, or discussing some aspect of ImageMagick on the discussions forum will generally result in new examples, or whole new sections, being added to these examples. The more discussion there is, the better the examples become.

If you are doing anything interesting with IM, please share, and allow me to provide examples of your technique to the rest of the IM community. Some of the biggest advances in IM usage have come from users just like you.

Special Thanks

A special thank you goes to Cristy, who has tirelessly spent months, upgrading, bug-fixing, and putting up with my off-the-wall suggestions... especially with regards to my major suggestions for the command line processing, parenthesis, image sequence operators, and GIF animation processing.

He has done a marvelous job making Version 7 the best and most advanced command line image processing program available. While most users will not show appreciation for that, I certainly do appreciate the effort he has put into IM.

I also want to thank Gabe Schaffer, who has been most helpful in discussions involving the JPEG format and library, affine matrix operators, and Magick Vector Graphics in general.

And to Glenn Randers-Pehrson, who wrote the PNG coder module and had an interest in Color Quantization and Dithering. He was the first to add 'halftone' dithering to IM, which I later revised and extended further, to added new dithers to the ordered dither configuration file.

And finally, I want to thank the huge number of people with problems, suggestions, and solutions, who generally lurk on the IM User Forum. Many now have their names as contributors of ideas and suggestions throughout IM Examples.

I also want to thank the people who regularly answer questions on the forums, such as 'Bonzo', and his web site RubbleWebs, detailing use of IM commands from PHP scripts. Also 'scri8e' and his Web site, Moons Stars, for glitter and star handling. Also a thank you goes to Pete 'el_supremo'

A special thanks goes to Fred Weinhaus, a researcher from the early days of image processing, who was a major help in the initial implementation of the General Image Distortion Operator. You can see Fred's ImageMagick scripts on Fred's ImageMagick Site, often as a proof of concept for future IM additions.

Also to Nicolas Robidoux, an expert in digital image processing, for reworking the Elliptical Weighted Average Resampling, which vastly improves the output of General Image Distortion.

And finally to the many users of ImageMagick who, had allowed others to see the IM commands they use as part of some project, either on the forums, or on the web. You are all to be commended on your willingness and openness to share your findings.



Well enough "Yadda, yadda, yadda."   Go look at some of the examples.


山海经讲的是什么 水浒传主要讲了什么 团长相当于地方什么官 尖嘴鱼叫什么鱼 甲状腺功能检查挂什么科
干眼症用什么眼药水 苋菜与什么食物相克 蝙蝠粪便是什么中药 牙龈萎缩用什么牙膏好 t是什么
女性白带多吃什么药 羊水什么颜色 啦啦是什么意思 什么叫甲亢病 性出血是什么原因造成的呢要怎么办
7月20号什么星座 吃什么药可以推迟月经 曹操是什么生肖 氯硝西泮片是什么药 夜夜笙歌什么意思
金钱肚是什么bysq.com 章鱼的血是什么颜色hcv9jop5ns2r.cn 健康证什么时候可以办hcv9jop3ns1r.cn 经常吃维生素c有什么好处和坏处hcv8jop8ns3r.cn 万事顺意是什么意思weuuu.com
肝火旺是什么意思hcv8jop8ns8r.cn 布洛芬吃多了有什么副作用hcv8jop8ns3r.cn 驴胶补血颗粒什么时候喝最好hcv7jop9ns3r.cn 鼻塞一直不好什么原因hcv9jop1ns8r.cn 豫州是现在的什么地方hcv8jop2ns1r.cn
生物碱是什么wzqsfys.com 小儿风寒感冒吃什么药最好hcv9jop5ns8r.cn 阳气是什么意思naasee.com 日主是什么意思hcv9jop7ns4r.cn 孕中期同房要注意什么hcv9jop1ns4r.cn
欣喜若狂的近义词是什么520myf.com 高高的什么hcv9jop0ns5r.cn 完璧归赵发生在什么时期96micro.com 七月十四是什么节bfb118.com 大腿为什么会长妊娠纹wuhaiwuya.com
百度