Offtopic: Into Commodore 64 (6502) coding, pixeling or music?
Xentax is looking for new members for the C64 activities!
Just drop us a message at forum@xentax.com and join the Scene Team!

Forum rules: Click here

ZLib library - Compression + Decompression

Coders and would-be coders alike, this is the place to talk about programming.
Post Reply
grimdoomer
advanced
Posts: 70
Joined: Fri Mar 21, 2008 8:11 pm
Location: New York
Been thanked: 1 time
Contact:

ZLib library - Compression + Decompression

Post by grimdoomer » Sun Nov 16, 2008 9:33 pm

I need a zlib library that I can use in my C# program. I've tried zlib.net, but it has some wierd compression error, were my output stream can end up with a length of 2? So I need one that works 100%.

Rheini
Moderator
Posts: 652
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 40 times
Contact:

Re: ZLib library - Compression + Decompression

Post by Rheini » Mon Nov 17, 2008 8:38 pm

http://datacompression.info/Zlib.shtml
maybe there's something for you.

grimdoomer
advanced
Posts: 70
Joined: Fri Mar 21, 2008 8:11 pm
Location: New York
Been thanked: 1 time
Contact:

Re: ZLib library - Compression + Decompression

Post by grimdoomer » Wed Nov 19, 2008 3:52 am

Thanks, that led me to a xceed library that worked perfect!

eycaramba
veteran
Posts: 86
Joined: Wed Sep 02, 2009 1:52 pm
Has thanked: 30 times
Been thanked: 1 time

Re: ZLib library - Compression + Decompression

Post by eycaramba » Sun Aug 29, 2010 2:25 pm

Is there a finished tool for it?
I cannot code but would really need a program to compress files with zlib. For some strange reason I cannot find any :eek:

EDIT: ZOMG 2k8 topic x.x I'm sorry :D But please help me anyway ^^"

merlinsvk
ultra-veteran
ultra-veteran
Posts: 411
Joined: Mon Oct 27, 2008 12:11 am
Location: Slovakia
Has thanked: 35 times
Been thanked: 117 times

Re: ZLib library - Compression + Decompression

Post by merlinsvk » Sun Aug 29, 2010 4:51 pm

eycaramba wrote:... a program to compress files with zlib.
Maybe Rheini's zlibc is what you are looking for viewtopic.php?p=20205#p20205

eycaramba
veteran
Posts: 86
Joined: Wed Sep 02, 2009 1:52 pm
Has thanked: 30 times
Been thanked: 1 time

Re: ZLib library - Compression + Decompression

Post by eycaramba » Sun Aug 29, 2010 5:27 pm

Yeah, this is exactly what I am looking for. Thank you, this is really nice :)
The thing is I have to deal with a filesize limit. If I re-compress the original unmodified file, the filesize exactly matches.
If I compress the modified file, the filesize is way bigger oO
Is this due to how zlib's algorhythm works? The Size on disk is the same, however I need to put back that file in a binary dump hex file and so yah...

Is there no other possibility than finding and modifying the file table (if there is any)?

merlinsvk
ultra-veteran
ultra-veteran
Posts: 411
Joined: Mon Oct 27, 2008 12:11 am
Location: Slovakia
Has thanked: 35 times
Been thanked: 117 times

Re: ZLib library - Compression + Decompression

Post by merlinsvk » Sun Aug 29, 2010 8:32 pm

I know nothing about compressing/programming etc., but did you try all 9 compression levels with zlibc?

eycaramba
veteran
Posts: 86
Joined: Wed Sep 02, 2009 1:52 pm
Has thanked: 30 times
Been thanked: 1 time

Re: ZLib library - Compression + Decompression

Post by eycaramba » Mon Aug 30, 2010 8:19 am

Yep. Mostly the same result, but never small like the original...

merlinsvk
ultra-veteran
ultra-veteran
Posts: 411
Joined: Mon Oct 27, 2008 12:11 am
Location: Slovakia
Has thanked: 35 times
Been thanked: 117 times

Re: ZLib library - Compression + Decompression

Post by merlinsvk » Mon Aug 30, 2010 10:45 am

Hmm I have no idea. Maybe Rheini or some "veteran" user could help you.

Rheini
Moderator
Posts: 652
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 40 times
Contact:

Re: ZLib library - Compression + Decompression

Post by Rheini » Mon Aug 30, 2010 12:12 pm

eycaramba wrote:If I compress the modified file, the filesize is way bigger oO
deflate basically works by exploiting repetitions in the code. It does so by using a history window that keeps track of the last x read bytes (e.g. 1KB). So if you modify the contents you get a different compression result.

brienj
VIP member
VIP member
Posts: 288
Joined: Mon May 02, 2005 1:48 pm
Location: Louisville, KY
Has thanked: 10 times
Been thanked: 68 times
Contact:

Re: ZLib library - Compression + Decompression

Post by brienj » Tue Aug 31, 2010 8:09 pm

Here's a few things to help with zlib compression/decompression. None of this is my creation, but the APL Zlib Tool can not be found anywhere on the internet anymore, so I uploaded it to my website for those that want to try it. I can not remember who created the actual APL Zlib Tool, or I could give the original author credit for it. I also have some source code that this tool was based on, and the source code according to the readme file is made by Mark Nelson, Tiny Software, markn@tiny.com, http://web2.airmail.net/markn, but I can no longer find this person on the internet, nor can I find a working website for him or his company.

Well anyway, here is the source code for the library:
http://brienj.home.insightbb.com/zlibtool.zip

And here is the installer for the APL Zlib Tool:
http://brienj.home.insightbb.com/aplzltsetup.rar

The APL Zlib Tool has the option to change the compression level from 0 to 9 and works with all zlib compression I've tried it on. I was once going to make a program to do it, but why re-invent the wheel, as they say. :lol:

Hope this is useful to some people. :)

Post Reply