imageMagick图片处理工具

ImageMagick是一套Linux下的开源图形处理工具,针对几乎所有的图片格式提供比较全面的图片处理功能。不像windows下的photoshop,先要双击运行,然后打开图片,然后才能对图片进行处理,ImageMagick可以直接在命令行下运行,加上几个参数,就可以得到想要的图片了,而大批量的处理图片也比photoshop简单的多,写个shell多循环几次就可以了。

假如我想给图片加个框,转一下,再加个阴影,输入以下的命令就可以了:

convert -size 400x180 hatching.jpg  -thumbnail '200x90>' 
-bordercolor white -border 6
-bordercolor grey60 -border 1
-background none -rotate 6
-background black ( +clone -shadow 60x4+4+4 ) +swap
-background none -flatten
-depth 8 -colors 256 -quality 95 poloroid.png

结果是这样:

除了提供命令行工作,ImageMagick同样为各种语言(包括Java,perl,php,c/c++,pascal,python,ruby,tcl/tk等)提供了丰富的开发接口。开发人员可以直接使用这些接口对图片进行高质量,效果丰富的处理。这些都是ImageMagick处理的效果:

更多的效果:Anthony Thyssen写的使用帮助,一些缩略图的效果,一些汽泡状缩略图效果。ImageMagick还有个比较酷的功能是可以做图片的比较:
[IM Output]== data-src=

ImageMagick安装起来也相当方便,以php为例,需要下载两个包,一个是ImageMagick的包,一个是MagickWand的包,打包下载后运行:

tar zxvf imagemagick.tar.gz
cd ImageMagick-xx-xx
./configure --prefix=/usr/local/ImageMagick
make && make install
export PATH=$PATH:/usr/local/ImageMagick/bin

这样ImageMagick就装完了,可以直接在任何一个目录下面运行命令行的程序了。下面我们假设机器上已经装好了某个版本的php,运行:

tar zxvf MagickWand.tar.gz
mv MagickWand-xx-xx /path/to/php-install/ext/
cd /path/to/php-install/ext/MagickWand-xx-xx/
phpize
cd /path/to/php-install
rm configure
./buildconf --force
./configure [options] --with-magickwand=/path/to/ImageMagick
make && make install

这样php就可以使用ImageMagick提供的函数了。

Subscribe

Related articles

Interpreting Marriage in Dreams: Good or Bad

Dreaming of marriage can symbolize unity or commitment in waking life. It may reflect a desire for partnership or emotional fulfillment. However, it could also represent anxieties about commitment or fears of loss of freedom. Remember that dream interpretations are subjective and can vary based on personal beliefs and experiences.

Romantic NYC Date Ideas: 10 Perfect Spots to Impress Your Date

Looking for a special date idea in NYC? From picnics in Central Park to sunset cocktails in Brooklyn, there are countless romantic spots to explore with your special someone. Let's discover the best options for an unforgettable date night in the Big Apple.

Who Should Attend the Bridal Shower? Your Complete Guide

The bridal shower is a special occasion where the bride is surrounded by her close family and friends. Traditionally, the guest list includes the bridal party, close relatives, and female friends who will celebrate with the bride ahead of her big day.

Ultimate Bach Party Gifts for the Bride-to-Be

Are you looking for the perfect gifts to celebrate the bride-to-be at her bachelorette party? From personalized items to pampering sets, we have the top picks to make her feel special before her big day.

Unveiling the Mystery: What is a Promise Ring and Its Romantic Significance

A promise ring is a symbol of commitment between couples. It represents a promise to be faithful and to one day marry. It is a romantic gesture that signifies a deep and meaningful relationship.

Enchanting Veil Hairstyles to Complete Your Bridal Look

Discover the elegance and romance of veil hairstyles. From soft waves to intricate updos, veils can be the perfect addition to any bridal look.

Unveiling the Magic of a Day-of Coordinator

A day of coordinator is like a behind-the-scenes magician, ensuring that every detail of your special day runs smoothly. They orchestrate the events with grace and precision, so you can focus on the romance and joy of your wedding day.

Unveiling the Magic of a Bridal Shower: What You Need to Know

A bridal shower is a cherished pre-wedding tradition where the bride-to-be is showered with love, gifts, and well wishes from close friends and family. It's a time for celebration and laughter as the bride prepares for her big day.
spot_imgspot_img

LEAVE A REPLY

Please enter your comment!
Please enter your name here