Home

OFF-SOFT.net

OFF-SOFT.net

This site is support & information site of WEB,and Software. This site might help you that create software or Web Site…perhaps?[:]

How to distribute Qt's application ( CutyCapt ) on Windows.

Published on| February 5th, 2011 | 1 Comment.
Description:
This post will see CutyCapt of Qt's application tool.

Recently, I came to see a lot of sites where the tool that used Qt had been opened to the public.
I will use open source Qt tool's CutyCapt on this post.

CutyCapt is
a small cross-platform command-line utility to capture WebKit's rendering of a web page into a variety of vector and bitmap formats, including SVG, PDF, PS, PNG, JPEG, TIFF, GIF, and BMP. See IECapt for a similar tool based on Internet Explorer.

For example, you may use when you want to introduce other web site.
This tool will help you that create image file of the web site. And you will easily update to cool post with the image file.
Also you may create program of automatically update web site images.
So , Easy.


Well, let's use it.

Using CutyCapt

First step, you should use CutyCapt if you do not know it. And you should see that CutyCapt has any function.

You may download Windows binaries from the following site.
Download site: Http://Cutycapt.sourceforge.net/
You will find the word Download on the center of the site. You will click and download on the web page.
Currently (2011.02) The latest version, CutyCapt-Win32-2010-04-26.zip (7MB,. Exe for Win32 systems)

The download file is ZIP file. The file will include only CutyCapt.exe.

Usage is simple.
You will type following characters on command prompt.

> CutyCapt.exe --url=http://www.yahoo.co.jp --out=yahoo.jpg


Well, you will find yahoo.jpg image files of Yahoo! Japan site.
--url is the URL of the site that you want to save.
--out is the file name that you want to save .
* File format will be automatically switched by extension.
If you use any special extensions, you should use --out-format options that specifies the format for the output image.

Following image is the saved image.
Yahoo! Japannのトップ画像
* This image is cut with screen size of this site. If you want to see real size image, you will click this image.

Also , CutyCapt has many parameters without above parameters.
You can see all parameters by the Help option( --help ).
 -----------------------------------------------------------------------------
 Usage: CutyCapt --url=http://www.example.org/ --out=localfile.png
 -----------------------------------------------------------------------------
  --help                         Print this help page and exit
  --url=<url>                    The URL to capture (http:...|file:...|...)
  --out=<path>                   The target file (.png|pdf|ps|svg|jpeg|...)
  --out-format=<f>               Like extension in --out, overrides heuristic
  --min-width=<int>              Minimal width for the image (default: 800)
  --min-height=<int>             Minimal height for the image (default: 600)
  --max-wait=<ms>                Don't wait more than (default: 90000, inf: 0)
  --delay=<ms>                   After successful load, wait (default: 0)
  --user-styles=<url>            Location of user style sheet, if any
  --header=<name>:<value>        request header; repeatable; some can't be set
  --method=<get|post|put>        Specifies the request method (default: get)
  --body-string=<string>         Unencoded request body (default: none)
  --body-base64=<base64>         Base64-encoded request body (default: none)
  --app-name=<name>              appName used in User-Agent; default is none
  --app-version=<version>        appVers used in User-Agent; default is none
  --user-agent=<string>          Override the User-Agent header Qt would set
  --javascript=<on|off>          JavaScript execution (default: on)
  --java=<on|off>                Java execution (default: unknown)
  --plugins=<on|off>             Plugin execution (default: unknown)
  --private-browsing=<on|off>    Private browsing (default: unknown)
  --auto-load-images=<on|off>    Automatic image loading (default: on)
  --js-can-open-windows=<on|off> Script can open windows? (default: unknown)
  --js-can-access-clipboard=<on|off> Script clipboard privs (default: unknown)
  --print-backgrounds=<on|off>   Backgrounds in PDF/PS output (default: off)
 -----------------------------------------------------------------------------
  <f> is svg,ps,pdf,itext,html,rtree,png,jpeg,mng,tiff,gif,bmp,ppm,xbm,xpm
 -----------------------------------------------------------------------------
 http://cutycapt.sf.net - (c) 2003-2010 Bjoern Hoehrmann - bjoern@hoehrmann.de

How to distribute Qt application

CutyCapt has been distributed by only 1 file.
CutyCapt license is GPL licensed. So, this application can link with Qt static library.
For example, if you want your Qt's application to apply non-GPL license( closed source ) , you must conform to the Qt license LGPL.

Qt license has two parts.
  • GPL/LGPL License
  • Commercial License
if you hope perfect coled source for your Qt' application, you should use Commercial License,
If you have Commercial License of Qt, you will not need this post. And you should use it license.

There is the problem of GPL/LGPL License.
Qt provided LGPL License with verion 4.5.
If you use version under 4.5 , you must conform to the Qt license GPL(not LPGL).So, this means that you must open your source code.

See also:
(middle position of page)

If you use version 4.5 or later, you must conform to the Qt license LPGL.So, if you want not to open your source code, you must not link with Qt static library.
Well you must link with Qt dynamic library.(DLL files of Windows)
So, you may distribute your Qt application with some dll files.

I will see how to distribute Qt application by CutyCapt.

Check dependency of Qt application

First step, I will re-build CutyCapt for DLL Link with the Qt version of the LGPL.
It is very easy if you have qt development environment. I will write this post assuming that you have qt development environment.

  1. Download the source code CutyCapt.
    Download Site: Http://Cutycapt.sourceforge.net/
    You will find the word Source code on the center of the site. You will click The source code is available in the SVN repositorty (download tarball). and download on the web page.

  2. Open CutyCapt.pro with the Qt Creator and re-build.
    If you find error, you should check you Qt development environment (VC + +2008).

Now, i get latest CutyCapt.exe .

This Qt application (CutyCapt) dependencies some DLL files. So, I will check what is any DLL files by Dependency Walker(MicorSoft).
Reference Articles:

I will open CutyCapt.exe by Dependency Walker, Following image shows you the dependencies of latest CutyCapt.exe.
Dependency Walkerの画面
All the dependent DLL files are listed in the table on the middle of the screen.

Most dll files may be provided by OS(Windows). I will get necessary dll files except dll files that provided by OS.

This application(CutyCapt.exe.) will need the following dll files.

  • MSVCP90.DLL
  • MSVCR90.DLL
  • PHONON4.DLL
  • QTCORE4.DLL
  • QTGUI4.DLL
  • QTNETWORK4.DLL
  • QTSVG4.DLL
  • QTWEBKIT4.DLL
  • QUERY.DLL
  • QUTIL.DLL

Perhaps, if i copy above files and CutyCapt.exe to other windows system(Windows2000 or later), I can execute CutyCapt.exe on copied windows system.
I tried it,

> CutyCapt.exe --url=http://www.yahoo.co.jp --out=yahoo.jpg

but I could not get jpeg file(yahoo.jpg) by CutyCapt.exe.
Let's try by png format,

> CutyCapt.exe --url=http://www.yahoo.co.jp --out=yahoo.png

I could get png file(yahoo.png) by CutyCapt.exe. But this image file was incorrect site image.
Following image is the saved image.
Yahoo! Japannのトップ画像
* This image is cut with screen size of this site. If you want to see real size image, you will click this image.

So, this way can not create all image file except png image.

This problem is caused by using Qt image plug-in.
* QTDIR:Qt install directory.

QTDIR\plugins\imageformats\
 
   qgif4.dll
   qgifd4.dll
   qico4.dll
   qicod4.dll
   qjpeg4.dll
   qjpegd4.dll
   qmng4.dll
   qmngd4.dll
   qsvg4.dll
   qsvgd4.dll
   qtiff4.dll
   qtiffd4.dll

There are 12 DLL files. But * d4.dll are debug files.
This application needs 6 DLL files of following .

qgif4.dll gif format plugin for.
qico4.dll ico plugin for formatting.
qjpeg4.dll The plug-in for jpeg format.
qmng4.dll mng plugin for formatting.
qsvg4.dll svg plugin for formatting.
qtiff4.dll The plug-in for tiff format.

Plug-in DLL files are available for each image format.
I copied this files and tried to create jpeg file, but I could not get jpeg file.

Warning
Qt plugin files should copy to derectory of plugin.
Example, Qt image plugin should copy to imageformats derectory of plugin.

<CutyCapt_install_dir>\
CutyCapt.exe
MSVCP90.DLL
MSVCR90.DLL
phonon4.dll
QTCORE4.DLL
QTGUI4.DLL
QTNETWORK4.DLL
QTSVG4.DLL
QTWEBKIT4.DLL
<CutyCapt_install_dir>\imageformats\
qgif4.dll
qico4.dll
qjpeg4.dll
qmng4.dll
qsvg4.dll
qtiff4.dll

Oh, many files .... .

Download CutyCapt.exe and Qt DLL files(self-extract file) :
I ignored detail license in this post. If you distribute your Qt application , you should check detail license.

Case CutyCapt, this application apply GPL, it will not cause any problem.

Comments

1 Comment. “How to distribute Qt’s application ( CutyCapt ) on Windows.”


  1. Cagdas
    January 20th, 2012 @ 08:55:49

    Thank you for saving my day! I had a customized CutyCapt built and I was wondering why it was not working on the production server. Putting image plugins inside “imageformats” directory just below the application root directory did the trick. God be with you!

    PS: You should better make Björn to give link to your page in http://cutycapt.sourceforge.net/

Leave a Reply







  • はてなブックマークへ追加する
  • Facebookでシェアする
  • twitter でつぶやく
  • Google Plusでシェアする
  • Pocketでシェアする
ページトップへ