[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4. Compression

ebzip (equivalent to ebunzip --compress and ebzipinfo --compress) compresses a CD-ROM book.

4.1 Example of Compression (1)  
4.2 Example of Compression (2)  
4.3 Compression Level  
4.4 Test  
4.5 Partial Compression  
4.6 Overwrite Old Files  
4.7 Compress Compressed Book  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.1 Example of Compression (1)

This section explains how to compress your CD-ROM book which has already copied on a hard disk. Supporse that you have already copied a CD-ROM book to `/dict' on a hard disk, but it is not compressed. The book has the following files under `/dict'.

 
/dict/catalog
/dict/language
/dict/kanji/start
/dict/english/start

You can compress the book by the following way:

 
% cd /dict
% ebzip

This is equivalent to:

 
% ebzip --output-directory /dict /dict

Compression may take a while. ebzip outputs status messages during the compression like as follows:

 
==> compress /dict/kanji/start <==
output to ./dict/kanji/start.ebz
 1.0% done (2097152 / 220069888 bytes)
 1.9% done (4194304 / 220069888 bytes)
 2.9% done (6291456 / 220069888 bytes)
        : (snip)
completed (220069888 / 220069888 bytes)
220069888 -> 78163751 bytes (35.5%)

When the compression has done, the directory structure under `/dict' is slightly changed.

 
/dict/catalog
/dict/language.ebz
/dict/kanji/start.ebz
/dict/english/start.ebz

The suffix `.ebz' is added to the some files (`/dict/language.ebz', `/dict/kanji/start.ebz' and `/dict/english/start.ebz'). They are compressed files. Other files are unchanged.

ebzip compresses the following files; `START', `HONMON', `HONMON2', `HONMONS', `LANGUAGE', and font files under the `GAIJI' directories.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.2 Example of Compression (2)

This section shows another example. This section explains how to compress files in a CD-ROM disc and put them onto a hard disk. Suppose that and original CD-ROM book is mounted on `/cdrom' and that the book has the following files under `/cdrom'.

 
/cdrom/catalog
/cdrom/language
/cdrom/german/start
/cdrom/french/start
/cdrom/italian/start

Execute the following commands to compress the book an put it on `/dict':

 
% cd /dict
% ebzip --keep /cdrom

This is equivalent to:

 
% ebzip --keep --output-directory /dict /cdrom

Please note that the output directory `/dict' may be empty, but it must have been created before compression. In this example, the `--keep' option is used. By default, ebzip deletes original files after compression, but the `--keep' option disables this behavior.

The directory strcture under `/dict' and `/cdrom' are almost the same, but the suffix `.ebz' is added to the compressed files under `/dict'.

 
/dict/catalog
/dict/language.ebz
/dict/german/start.ebz
/dict/french/start.ebz
/dict/italian/start.ebz

The intermediate directories, `/dict/german', `/dict/french' and `/dict/italian', are created by ebzip if missing. `catalog' and `catalogs' are simply copied to the output directory. ebzip ignores files and directories not supported by EB Library (i.e. not compressed or copied to the output directory).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.3 Compression Level

ebzip supports six compression levels, from 0 to 5. The compression level 0 is the fastest compression/uncompression method, but it is the worst compression method. The compression level 5 is the best compression method but it is the slowest compression/uncompression method. The compression level is set by the `--level' (`-l') option.

 
% ebzip --level 2 --output-directory /dict /dict

The default level is 0 (fastest but worst).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.4 Test

Invoking ebzip with the --test (-t) option, ebzip doesn't write compressed data to actual files. This is usuful when you want to know the sizes of compressed files before compression.

 
% ebzip --test /dict /dict


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.5 Partial Compression

ebzip compresses an entire book by default, but the `--subbook' (`-S') and `--skip-content' (`-s') options allow you to compress part of a book.

The `--subbook' option takes an argument which is a list of directory names of subbooks to be compressed, separeted by a comma (`,'). The ebinfo command tells you what subbooks your book contains and what their directory names are.

 
% ebinfo /mnt/cdrom
disc type: EB/EBG/EBXA/EBXA-C/S-EBXA
character code: JIS X 0208
the number of subbooks: 3

subbook 1:
  title: New English Japanese Dictionary (4th edition)
  directory: english
  search methods: word endword keyword menu
  font sizes: 16 24 30 48
  narrow font characters: 0xa121 -- 0xa24e
  wide font characters: 0xa321 -- 0xa27e

subbook 2:
  title: CD-ROM French Japanese Dictionary (3rd edition)
  directory: french
  search methods: word endword keyword menu
  font sizes: 16 24 30 48
  narrow font characters: 
  wide font characters: 0xa321 -- 0xa27e

subbook 3:
  title: Pocket German Japanese Dictionary (3rd edition)
  directory: german
  search methods: menu
  font sizes: 16 24 30 48
  narrow font characters: 
  wide font characters: 0xa321 -- 0xa27e

(See section `Invoke ebinfo' in ebinfo, for more details about the ebinfo command).
In this example, there are three subbooks in the book, and their directory names are english, french and german. By the following, you can compress english and french:

 
% ebzip --subbook english,french /dict

Case of the directory names are not sensitve. An argument to `--subbook' can be splitted like as follows:

 
% ebzip --subbook english --subbook french /dict

Files in the rest subbooks (german in this example) are not compressed nor copied, so that the compression procedure for the book is incompleted at this point. In order to use the book, you must compress the rest subbooks in a further operation, or deletes the rest subbooks from a subbook list in the `catalog(s)' file by using the ebrefile command (See section `Combination with ebzip' in ebrefile, for more details). You can compress subbooks with different compression levels (e.g. compress english and french with level 0, and compress german with level 2).

The `--skip-content' (`-s') is similar to `--subbook', but `--skip-content' specifies data types of files to be ignored.

 
% ebzip --skip-content sound,movie --subbook french /dict

In this example, ebzip skips sound and movie files. The data type names currently recognized by ebzip are: font, graphic, sound and movie.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.6 Overwrite Old Files

ebzip asks you whether a file may be overwritten or not when the file already exists.

 
==> compress /dict/science/data/honmon <==
output to /dict/science/data/honmon.ebz

the file already exists: /dict/science/data/honmon.ebz
do you wish to overwrite (y or n)? 

Please answer `y' or `n'. If you answer as `n', ebzip skips the file.

When the `--force-overwrite' option is specified, ebzip overwrites existed files without confirmation. Similary, when the `--no-overwrite' option is specified, ebzip skips the file without confirmation.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.7 Compress Compressed Book

Also S-EBXA and EPWING define compression formats, and some CD-ROM books of S-EBXA and EPWING are compressed with the formats. However, their compression formats are different from that of ebzip.

ebzip (ebunzip) can also uncompress CD-ROM book compressed with the EPWING or S-EBXA compression fomrat, but it cannot compress book with the format.

If you command ebzip to compress a CD-ROM book which has been compressed with a compression format, ebzip automatically uncompresses the book and compresses it with the ebzip compression.

Compression ratio of the ebzip compression format is generally better than those of EPWING and S-EBXA formats.


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by Motoyuki Kasahara on December, 28 2003 using texi2html