scantools  1.0.4
Graphics manipulation with a view towards scanned documents
compression.h
1 /*
2  * Copyright © 2017 Stefan Kebekus <stefan.kebekus@math.uni-freiburg.de>
3  *
4  * This program is free software: you can redistribute it and/or modify it under
5  * the terms of the GNU General Public License as published by the Free Software
6  * Foundation, either version 3 of the License, or (at your option) any later
7  * version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 
19 #ifndef COMPRESSION
20 #define COMPRESSION 1
21 
22 #include <QByteArray>
23 #include <QImage>
24 
25 
28 namespace compression
29 {
39 
46  filtered
47  };
48 
68  QImage faxG4Decode(const QByteArray &data, int width, int heightEstimate=0);
69 
103  QByteArray faxG4Encode(const QImage &image);
104 
117  QByteArray zlibCompress(const QByteArray &src, zlibCompressionStrategy strategy=standard);
118 
140  QByteArray zlibUncompress(const QByteArray &src, quint64 estimatedOutputSize=0);
141 
154  QByteArray zopfliCompress(const QByteArray &src);
155 };
156 
157 #endif
This namespace gathers static methods for data compression and decompression.
Definition: compression.h:29
QByteArray zlibUncompress(const QByteArray &src, quint64 estimatedOutputSize=0)
Uncompresses a QByteArray using zlib.
QByteArray zopfliCompress(const QByteArray &src)
Compresses a QByteArray using zopfli.
QByteArray zlibCompress(const QByteArray &src, zlibCompressionStrategy strategy=standard)
Compresses a QByteArray using zlib.
zlibCompressionStrategy
Compression strategy.
Definition: compression.h:36
@ filtered
Strategy for data thar consists mostly of small values with a somewhat random distribution.
Definition: compression.h:46
@ standard
The default strategy is best for general data.
Definition: compression.h:38
QByteArray faxG4Encode(const QImage &image)
Compresses a bitonal image following the CCITT Group 4 compression standard.
QImage faxG4Decode(const QByteArray &data, int width, int heightEstimate=0)
Decompresses a bitonal image following the CCITT Group 4 compression standard.