2010年10月14日 星期四

CentOS 5.5 Install CutyCapt 實作


  1. (x64)
    wget http://dl.atrpms.net/el5-x86_64/atrpms/testing/qt44-4.4.3-10_4.el5.x86_64.rpm
    wget http://dl.atrpms.net/el5-x86_64/atrpms/testing/qt44-x11-4.4.3-10_4.el5.x86_64.rpm
    wget http://dl.atrpms.net/el5-x86_64/atrpms/testing/qt44-devel-4.4.3-10_4.el5.x86_64.rpm


    rpm -ivh qt44-4.4.3-10*
    rpm -ivh qt44-x11-4.4.3-10*
    rpm -e qt-devel --nodeps --allmatches
    rpm -ivh qt44-devel-4.4.3-10*
    rpm -rebuilddb

  2. 加入 QT 目錄到環境參數中
    vim /etc/profile
    #==================================================
    export QTDIR=/usr/lib64/qt44
    export QTLIB=/usr/lib64/qt44/lib
    export QTINC=/usr/lib64/qt44/include
    export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
    export PATH=$QTDIR/bin:$PATH
    #==================================================

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

  4. CutyCapt 截圖指令
    ./CutyCapt --url=http://tw.yahoo.com --out=yahoo.png

  5. 此時如系統無安裝 X-Windows 會出現CutyCapt: cannot connect to X server 需另掛上 xfvb 模擬 X-Windows 環境
    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

  6. 透過 xfvb-run 模擬 X-Windows 截圖指令
    /usr/local/CutyCapt/xvfb-run.sh /usr/local/CutyCapt/CutyCapt --url=http://tw.yahoo.com --out=yahoo.png


  7. 截圖如出現亂碼或是無字串, 需檢查是否有安裝適當字型
    yum install fonts-chinese

  8. 更改環境語系值為網址語系,再截圖一次即可
    LANG=UFT-8
    /usr/local/CutyCapt/xvfb-run.sh /usr/local/CutyCapt/CutyCapt --url=http://tw.yahoo.com --out=yahoo.png




    後記

    xvfb-run 參數
    xvfb-run –server-args="-screen 0, 1024x768x24〞     模擬 X-Windows 大小色彩
    xvfb-run –wait=10                    模擬 X-Windows 啟動後延遲幾秒後執行指令

1 則留言:

  1. 您好,我執行到第 3 步的 gmake 那邊時,出現:
    gmake: *** No targets specified and no makefile found. Stop.
    小弟跟您用的一樣是 CentOS5.5,不知道您是怎麼解決的?

    回覆刪除