Google Site SearchFN Site Search FN Blog Login FN Blog Login
Site Navigation:
 
 

HOWTO: VNC SnapShot

by Casper Pedersen on October 1, 2004

VNC is a very usefull tool, and if you do not know it please read about it on http://www.realvnc.com or on http://www.tightvnc.com/. But what I sometimes would like to have is a tool which can take screendumps directly, and this is exactly what vncsnapshot can do.

Here I will give the steps to create .rpm for it.

  1. Make sure that you have libjpeg-devel and zlib-devel installed:
    [casper@localhost casper]$ su -
    password:
    [root@localhost root]$ yum install zlib-devel
    ....
    [root@localhost root]$ yum install libjpeg-devel
    ....
    
    This will also install libjpeg and zlib which are needed for the installation.
  2. Download vncsnapshot-1.2a.tar.gz from http://sourceforge.net/project/showfiles.php?group_id=46166 and save it to rpmbuild/SOURCES.
  3. Download vncsnapshot.spec and save it to rpmbuild/SPECS
  4. Now build vncsnapshot: Open a terminal and change to your SPECS directory:
    [casper@localhost casper]$ cd rpmbuild/SPECS
    [casper@localhost SPECS]$ rpmbuild -ba vncsnapshot.spec
    Executing(%prep): /bin/sh -e /home/casper/rpmbuild/TMP/rpm-tmp.96950
    + umask 022
    + cd /home/casper/rpmbuild//BUILD
    + LANG=C
    + export LANG
    + unset DISPLAY
    + mkdir -p /home/casper/rpmbuild/TMP/vncsnapshot-1.2a-1.fdr-root-casper/usr/bin
    + mkdir -p /home/casper/rpmbuild/TMP/vncsnapshot-1.2a-1.fdr-root-casper/usr/shar e/man/man1
    + cd /home/casper/rpmbuild/BUILD
    + rm -rf vncsnapshot-1.2a
    + /usr/bin/gzip -dc /home/casper/rpmbuild/SOURCES/vncsnapshot-1.2a-src.tar.gz
    + tar -xf -
    + STATUS=0
    + '[' 0 -ne 0 ']'
    + cd vncsnapshot-1.2a
    ++ /usr/bin/id -u
    + '[' 1002 = 0 ']'
    ++ /usr/bin/id -u
    + '[' 1002 = 0 ']'
    + /bin/chmod -Rf a+rX,u+w,g-w,o-w .
    + exit 0
    Executing(%build): /bin/sh -e /home/casper/rpmbuild/TMP/rpm-tmp.63800
    + umask 022
    + cd /home/casper/rpmbuild//BUILD
    + cd vncsnapshot-1.2a
    + LANG=C
    + export LANG
    + unset DISPLAY
    + make
    cd rdr;make all
    make[1]: Entering directory `/home/casper/rpmbuild/BUILD/vncsnapshot-1.2a/rdr'
    g++  -I. -I..      -c -o FdInStream.o FdInStream.cxx
    echo FdInStream.o FdInStream.cxx
    FdInStream.o FdInStream.cxx
    g++  -I. -I..      -c -o InStream.o InStream.cxx
    echo InStream.o InStream.cxx
    InStream.o InStream.cxx
    g++  -I. -I..      -c -o ZlibInStream.o ZlibInStream.cxx
    echo ZlibInStream.o ZlibInStream.cxx
    ZlibInStream.o ZlibInStream.cxx
    g++  -I. -I..      -c -o FdOutStream.o FdOutStream.cxx
    echo FdOutStream.o FdOutStream.cxx
    FdOutStream.o FdOutStream.cxx
    g++  -I. -I..      -c -o NullOutStream.o NullOutStream.cxx
    echo NullOutStream.o NullOutStream.cxx
    NullOutStream.o NullOutStream.cxx
    g++  -I. -I..      -c -o ZlibOutStream.o ZlibOutStream.cxx
    echo ZlibOutStream.o ZlibOutStream.cxx
    ZlibOutStream.o ZlibOutStream.cxx
    ar cr librdr.a FdInStream.o      InStream.o         ZlibInStream.o FdOutStream.o   NullOutStream.o  ZlibOutStream.o
    ranlib librdr.a
    make[1]: Leaving directory `/home/casper/rpmbuild/BUILD/vncsnapshot-1.2a/rdr'
    gcc -O2 -Wall -I. -I/usr/local/include -I/usr/local/include    -c -o argsresourc es.o argsresources.c
    argsresources.c:23: warning: `ID' defined but not used
    gcc -O2 -Wall -I. -I/usr/local/include -I/usr/local/include    -c -o buffer.o bu ffer.c
    buffer.c:23: warning: `ID' defined but not used
    gcc -O2 -Wall -I. -I/usr/local/include -I/usr/local/include    -c -o cursor.o cu rsor.c
    cursor.c:24: warning: `ID' defined but not used
    gcc -O2 -Wall -I. -I/usr/local/include -I/usr/local/include    -c -o listen.o li sten.c
    listen.c:23: warning: `ID' defined but not used
    gcc -O2 -Wall -I. -I/usr/local/include -I/usr/local/include    -c -o rfbproto.o rfbproto.c
    In file included from rfbproto.c:762:
    protocols/tight.c: In function `FilterGradient32':
    protocols/tight.c:428: warning: suggest parentheses around + or - in operand of &
    protocols/tight.c:442: warning: suggest parentheses around + or - in operand of &
    rfbproto.c: At top level:
    rfbproto.c:26: warning: `ID' defined but not used
    g++ -O2 -Wall -I. -I/usr/local/include -I/usr/local/include    -c -o sockets.o s ockets.cxx
    sockets.cxx:24: warning: `const char*ID' defined but not used
    gcc -O2 -Wall -I. -I/usr/local/include -I/usr/local/include    -c -o tunnel.o tu nnel.c
    tunnel.c:24: warning: `ID' defined but not used
    gcc -O2 -Wall -I. -I/usr/local/include -I/usr/local/include    -c -o vncsnapshot .o vncsnapshot.c
    vncsnapshot.c:23: warning: `ID' defined but not used
    gcc -O2 -Wall -I. -I/usr/local/include -I/usr/local/include    -c -o d3des.o d3d es.c
    gcc -O2 -Wall -I. -I/usr/local/include -I/usr/local/include    -c -o vncauth.o v ncauth.c
    vncauth.c:30: warning: `ID' defined but not used
    g++ -O2 -Wall -I. -I/usr/local/include -I/usr/local/include    -c -o zrle.o zrle .cxx
    g++ -O2 -Wall -I. -I/usr/local/include -I/usr/local/include     -O2 -Wall -o vnc snapshot argsresources.o buffer.o cursor.o listen.o rfbproto.o sockets.o tunnel. o vncsnapshot.o d3des.o vncauth.o zrle.o  rdr/librdr.a -L/usr/local/lib -lz -L/u sr/local/lib -ljpeg
    gcc -O2 -Wall -I. -I/usr/local/include -I/usr/local/include    -c -o vncpasswd.o  vncpasswd.c
    gcc -O2 -Wall -I. -I/usr/local/include -I/usr/local/include     -O2 -Wall -o vnc passwd vncpasswd.o vncauth.o d3des.o
    + exit 0
    Executing(%install): /bin/sh -e /home/casper/rpmbuild/TMP/rpm-tmp.30877
    + umask 022
    + cd /home/casper/rpmbuild//BUILD
    + cd vncsnapshot-1.2a
    + LANG=C
    + export LANG
    + unset DISPLAY
    + cp -ar vncsnapshot /home/casper/rpmbuild/TMP/vncsnapshot-1.2a-1.fdr-root-caspe r/usr/bin
    + cp -ar vncpasswd /home/casper/rpmbuild/TMP/vncsnapshot-1.2a-1.fdr-root-casper/ usr/bin/vncpassword-vncsnapshot
    + cat vncsnapshot.man1
    + gzip -c
    + /usr/lib/rpm/find-debuginfo.sh /home/casper/rpmbuild//BUILD/vncsnapshot-1.2a
    extracting debug info from /home/casper/rpmbuild/TMP/vncsnapshot-1.2a-1.fdr-root -casper/usr/bin/vncsnapshot
    extracting debug info from /home/casper/rpmbuild/TMP/vncsnapshot-1.2a-1.fdr-root -casper/usr/bin/vncpassword-vncsnapshot
    0 blocks
    + /usr/lib/rpm/redhat/brp-compress
    + /usr/lib/rpm/redhat/brp-strip /usr/bin/strip
    + /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
    + /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
    Processing files: vncsnapshot-1.2a-1.fdr
    Executing(%doc): /bin/sh -e /home/casper/rpmbuild/TMP/rpm-tmp.30877
    + umask 022
    + cd /home/casper/rpmbuild//BUILD
    + cd vncsnapshot-1.2a
    + DOCDIR=/home/casper/rpmbuild/TMP/vncsnapshot-1.2a-1.fdr-root-casper/usr/share/ doc/vncsnapshot-1.2a
    + export DOCDIR
    + rm -rf /home/casper/rpmbuild/TMP/vncsnapshot-1.2a-1.fdr-root-casper/usr/share/ doc/vncsnapshot-1.2a
    + /bin/mkdir -p /home/casper/rpmbuild/TMP/vncsnapshot-1.2a-1.fdr-root-casper/usr /share/doc/vncsnapshot-1.2a
    + cp -pr BUILD BUILD.unix BUILD.win32 CHANGE-LOG.txt MANIFEST README RELEASE-NOT ES-1.1.txt RELEASE-NOTES.txt web-page.html /home/casper/rpmbuild/TMP/vncsnapshot -1.2a-1.fdr-root-casper/usr/share/doc/vncsnapshot-1.2a
    + exit 0
    Requires(interp): /bin/sh /bin/sh
    Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHave Prefix) <= 4.0-1
    Requires(preun): /bin/sh
    Requires(postun): /bin/sh
    Requires: libc.so.6 libc.so.6(GLIBC_2.0) libc.so.6(GLIBC_2.1) libc.so.6(GLIBC_2. 1.3) libc.so.6(GLIBC_2.3) libgcc_s.so.1 libgcc_s.so.1(GCC_3.0) libjpeg libjpeg.s o.62 libm.so.6 libstdc++.so.5 libstdc++.so.5(CXXABI_1.2) libstdc++.so.5(GLIBCPP_ 3.2) libz.so.1 zlib >= 1.2
    Processing files: vncsnapshot-debuginfo-1.2a-1.fdr
    Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHave Prefix) <= 4.0-1
    Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/casper/rpmbuild/ TMP/vncsnapshot-1.2a-1.fdr-root-casper
    Wrote: /home/casper/rpmbuild/SRPMS/vncsnapshot-1.2a-1.fdr.src.rpm
    Wrote: /home/casper/rpmbuild/RPMS/i386/vncsnapshot-1.2a-1.fdr.i386.rpm
    Wrote: /home/casper/rpmbuild/RPMS/i386/vncsnapshot-debuginfo-1.2a-1.fdr.i386.rpm
    Executing(%clean): /bin/sh -e /home/casper/rpmbuild/TMP/rpm-tmp.50512
    + umask 022
    + cd /home/casper/rpmbuild//BUILD
    + cd vncsnapshot-1.2a
    + rm -rf /home/casper/rpmbuild/TMP/vncsnapshot-1.2a-1.fdr-root-casper
    + exit 0
    [casper@localhost SPECS]$
    
  5. Now install the files:
    [casper@localhost SPECS]$ su
    Password:
    [root@localhost SPECS]# rpm -ivh ../RPMS/i386/vncsnapshot-1.2a-1.fdr.i386.rpm
    Preparing...                ########################################### [100%]
       1:vncsnapshot            ########################################### [100%]
    [root@localhost SPECS]#
    
  6. Now it's time to test it......
    [casper@localhost casper]$ vncsnapshot -quality 50 -compresslevel 9 linux:0 test.jpg
    VNC server supports protocol version 3.7 (viewer 3.3)
    Password:
    VNC authentication succeeded
    Desktop name "LibVNCServer"
    Connected to VNC server, using protocol version 3.3
    VNC server default format:
      16 bits per pixel.
      Least significant byte first in each pixel.
      True colour: max red 31 green 63 blue 31, shift red 11 green 5 blue 0
      32 bits per pixel.
      Least significant byte first in each pixel.
      True colour: max red 255 green 255 blue 255, shift red 0 green 8 blue 16
    Image saved from (local host) 1280x1024 screen to test.jpg using 1280x1024+0+0 rectangle
    [casper@localhost casper]$
    

For more inforamtion