文章会有【原创】或者【转载】标示,部分来自Google Baidu的学习结果 {Java/PHP/Python/Ruby/Go}

centos 安装CutyCapt【转载】  


转载自http://www.codeshows.com/centos-%E5%AE%89%E8%A3%85cutycapt/

先安装Qt47


增加qt47的下载源
vi /etc/yum.repos.d/atrpms.repo
[atrpms]
name=CentOS $releasever – $basearch – ATrpms
baseurl=http://dl.atrpms.net/el$releasever-$basearch/atrpms/stable
gpgkey=http://ATrpms.net/RPM-GPG-KEY.atrpms
gpgcheck=1
enabled=1
[atrpms-testing]
name=CentOS $releasever – $basearch – ATrpms testing
baseurl=http://dl.atrpms.net/el$releasever-$basearch/atrpms/testing
gpgkey=http://ATrpms.net/RPM-GPG-KEY.atrpms
gpgcheck=1
enabled=1
yum update
yum install qt47
yum install qt47-devel
yum install qt47-webkit
yum install qt47-webkit-devel

vi /etc/profile 加上

export QTDIR=/usr/lib64/qt47
export PATH=$QTDIR/bin:$PATH

安装 CutyCapt


svn co https://cutycapt.svn.sourceforge.net/svnroot/cutycapt
mv cutycapt/CutyCapt /usr/local/cutycapt
cd /usr/local/cutycapt
qmake
make

下载个x-server

wget http://www.flexthinker.com/wp-content/uploads/2009/11/xvfb-run.sh.txt
mv ./xvfb-run.sh.txt /usr/local/cutycapt/xvfb-run.sh
chmod u+x /usr/local/CutyCapt/xvfb-run.sh

安装中文包


yum install fonts-chinese

安装ImageMagick


yum install ImageMagick

最后就可以happy的截图了,如下:


/usr/local/cutycapt/xvfb-run.sh –server-args=”-screen 0, 1024x768x24″ /usr/local/cutycapt/CutyCapt –url=http://www.163.com –out=163.jpg
//convert截取第一屏
convert -crop  1024×768+0+0 /data/www/imark-image/screenshot/jVK_LBPG-a4..jpg  /data/www/imark-image/screenshot/jVK_LBPG-a4._fs.jpg
//convert缩放第一屏
convert -resize 20%x20% /data/www/imark-image/screenshot/jVK_LBPG-a4._fs.jpg /data/www/imark-image/screenshot/jVK_LBPG-a4._20_20.jpg