Comments (5)
Hi Rafael,
I am not sure what you are trying to do and what you call 'kanzi format'.
The block compressor allows many different options for transform and
entropy. Depending on the option you choose, you decide whether you want
fast compression (but low compression ratio ... like LZ4) or slow
compression (but high compression ratio, say BWT+CM). Block size also
matters. Which option combination are you using ? BWT+CM or BWT+PAQ is
going to beat GZ hands down in compression ratio. So, it really depends on
your compression command line options.
Frederic
On Sat, Apr 18, 2015 at 6:22 PM, rafaelpivetta [email protected]
wrote:
I have tested the kanzi package with a image and the performance is
fastest than LZ4 and GZ, you really has done a great job.
But the gz format is more compressed than that kanzi, 7 kb aproximately.
It's possible reduce the size of the kanzi format? Or this is not the
objective of the kanzi format?
In my test the size buffer in .gz is the same that kanzi format 32768.GZIPOutputStream out = new GZIPOutputStream(new FileOutputStream(outfile));
byte[] buf = new byte[32768];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}—
Reply to this email directly or view it on GitHub
#1.
from kanzi.
Frederic,
Two objectives:
1 - resize a large image to 640x480 ( pixels ) if possible without losing quality , the image should have a maximum of 35 Kb . I'm not sure if kanzi.jar is used for this.
2 - Compress the previous image using BlockCompressor line command or the method compressKanzi(String arg) of the class TestSnappy.java (BWT + CM).
I would like the file size was smaller than using GZIPOutputStream.
Rafael
from kanzi.
Rafael,
A few comments.
First, using a generic data compressor will not work as well as an image compressor. You may just want to try Java's JPEG encoder:
JPEGImageWriter imageWriter = (JPEGImageWriter) ImageIO.getImageWritersBySuffix("jpeg").next();
ImageOutputStream ios = ImageIO.createImageOutputStream(fos);
imageWriter.setOutput(ios);
Second, if you want to use Kanzi's block compressor, do not use TestSnappy.java. Snappy is geared towards speed but has a weak compression ratio and the class TestSnappy is not part of the project but used to compared implementation speeds. To get a better compression ratio with the block compressor,
from the command line: java -cp kanzi.jar kanzi.app.BlockCompressor -input=XXX -output=XXX.knz -overwrite -block=1m -transform=bwt -entropy=cm
from code: you can instantiate BlockCompressor or CompressedOutputStream. See BlockCompressor.java.
EG: new CompressedOutputStream("CM", "BWT", fileouputstream, 1024*1024, true, null, 1);
Obviously the block compressor is lossless, so in order to achieve a goal of 35 kb, you may have to drop some data during phase 1 (resize). Take a look at kanzi.util.sampling (and the use in kanzi.test.TestColorModel). You could down sample the image by 2 (x4 smaller) then block compress with a miminal quality loss or transform to YUV420 color model (U&V down sampled by 2).
from kanzi.
Frederic,
Ok.
With the "-options" -transform=bwt -entropy=cm or -transform=bwt -entropy=paq, the image file (jpeg) compressed (.knz) is smaller than .gz.
In the TestColorModel test, the error below occurs. My image is 640x480 and the source code kanzi-master.zip.
640x480
================ Test round trip RGB -> YXX -> RGB ================
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1
at kanzi.util.color.XYZColorModelConverter.convertYUVtoRGB(XYZColorModelConverter.java:200)
at kanzi.test.TestColorModel.test(TestColorModel.java:155)
at kanzi.test.TestColorModel.main(TestColorModel.java:120)
from kanzi.
I fixed the ArrayIndexOutOfBoundsException in the latest push.
from kanzi.
Related Issues (15)
- Go code (benchmarks in particular) are not go-gettable. HOT 2
- Kanzi not available on Maven Central? HOT 5
- BWTBlockCodec requires 1Gb+ of memory regardless of input or options HOT 2
- extra space HOT 3
- when I tried to use the same algorithm on PDF and DOCX formats, the effect was not ideal. HOT 2
- no main manifest attribute, in kanzi-x.x.x.jar HOT 5
- Documentation: LZ4 release version? HOT 2
- Help with an example on image java! HOT 7
- The wiki pdf link is dead HOT 1
- "index out of range" in BWT transform HOT 2
- "index out of range" in Go BWT tranform HOT 1
- Go BWT transform freezes on some input HOT 2
- Go BWT Inverse on a particular file generates "index out of range" error HOT 1
- "index out of range" error in Go BWT Forward transform HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kanzi.