compression

Optimized order of HTML attributes for compression

為{幸葍}努か 提交于 2019-12-05 18:02:25
问题 I read somewhere that organizing HTML attributes in a certain order can improve the rate of compression for the HTML document. (I think I read this from Google or Yahoo recommendation for faster sites). If I recall correctly, the recommendation was to put the most common attributes first (e.g. id , etc.) then put the rest in alphabetical order. I'm a bit confused by this. For example, if id attributes were put right after every p tag, the id would contain unique values. Thus, the duplicated

Exception in thread “main” java.util.zip.DataFormatException: incorrect header check

 ̄綄美尐妖づ 提交于 2019-12-05 17:31:32
i've wrote an an application in Java for compressing & decompressing the String using Deflaor and Inflator. but when i run the below code i'm getting the following exception. can anyone please tell me some solutions for this Deflated String:x��Q�n�0��@>"C��E����3�,[ d����9��P������x�O�����hcy��L �Ct��{~m�I:�$�%\HD+�I� �NwG Exception in thread "main" java.util.zip.DataFormatException: incorrect header check at java.util.zip.Inflater.inflateBytes(Native Method) at java.util.zip.Inflater.inflate(Inflater.java:223) at java.util.zip.Inflater.inflate(Inflater.java:240) at sample_ftp.Sample_ftp.main

Boost Iostreams zlib_error with Custom Source

馋奶兔 提交于 2019-12-05 16:28:02
I am trying to use a zlib_decompressor to decompress data through an istreambuf_iterator . I couldn't find an in built way to use an input iterator as input to a stream (please point out a way if one exists already) so I wrote this source: template <class cha_type, class iterator_type> class IteratorSource { public: typedef cha_type char_type; typedef boost::iostreams::source_tag category; iterator_type& i; iterator_type eof; IteratorSource(iterator_type& it, iterator_type end) : i(it), eof(end) { } std::streamsize read(char* s, std::streamsize n) { for(int j = 0; j < n; j++) { if(i == eof) {

SharpLibZip: Add file without path

落爺英雄遲暮 提交于 2019-12-05 15:02:30
问题 I'm using the following code, using the SharpZipLib library, to add files to a .zip file, but each file is being stored with its full path. I need to only store the file, in the 'root' of the .zip file. string[] files = Directory.GetFiles(folderPath); using (ZipFile zipFile = ZipFile.Create(zipFilePath)) { zipFile.BeginUpdate(); foreach (string file in files) { zipFile.Add(file); } zipFile.CommitUpdate(); } I can't find anything about an option for this in the supplied documentation. As this

Does compressing an image make the image use less memory? [closed]

被刻印的时光 ゝ 提交于 2019-12-05 14:50:32
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center . Closed 7 years ago . This is sort of an architectural/conceptual question regarding how a system (specifically a web browser) handles compressed images. We're dealing with an "image gallery" web app at work that has eleven 1920x1080 images on a page that you can swipe through on an iPad. We're finding it to be extremely slow and I'm

Setup Jetty GzipHandler programmatically

∥☆過路亽.° 提交于 2019-12-05 14:40:50
I'm playing with Jetty GzipHandler and it seems to work rather strangely: It only compresses already compressed files. My whole setup is GzipHandler gzipHandler = new GzipHandler(); gzipHandler.setHandler(myHandler); server.setHandler(gzipHandler); The browser (Chromium) always sends a header containing Accept-Encoding:gzip,deflate,sdch so according to the documentation GZIP Handler This handler will gzip the content of a response if: The filter is mapped to a matching path The response status code is >=200 and <300 The content length is unknown or more than the minGzipSize initParameter or

PPMD compression in Java?

微笑、不失礼 提交于 2019-12-05 14:14:35
Does anyone know of a Java implementation of the PPMD compression algorithm? I have not been able to find a Java implementation, but there is a C# implementation at http://users.senet.com.au/~mjbone/Compression.html that is about 4k lines of code. I'm not going to ask if anyone feels like porting it to Java... I was using for the same implementation, and couldn't find any. But I found that 7zip gives the source code of their ppmd implementation just in C++, not in java (at least, until now). I used system call's to 7zip do compress the data I need, using the command-line version of 7zip.

Hierarchical JPEG Encoder/Decoder

旧时模样 提交于 2019-12-05 13:59:00
问题 Does anyone knows of any implementation of the hierarchical JPEG mode (ITU T.81) ? I am not talking about progressive mode (or sequential), I really mean the hierarchical mode. 回答1: After some googling, I finally found out: https://github.com/thorfdbg/libjpeg Which was referenced from: http://calendar.perfplanet.com/2012/progressive-jpegs-a-new-best-practice/ This seems by far the more advanced option. Some other results showed: http://flying_oe.tripod.com/academic/SoC/cs3242/index.html And

Convert TIFF LZW to CCITT

こ雲淡風輕ζ 提交于 2019-12-05 13:44:07
This is a question about TIFF and compression. I have hundreds of LZW compressed tiff images. I wonder, is it possible to convert those to CCITT T.6? Is there some API? Please help. Bobrovsky LZW compression can be used to compress almost any image. CCITT T.6 can compress only bilevel (black and white) images. If your images are bilevel ones and they are compressed with LZW compression then you can recompress them using tiffcp utility (comes with LibTiff.Net library, free, source code available). If your images are full-color ones then you will have to convert them to bilevel first. One of my

SharpZipLib library Compress a folder with subfolders with high level compresion and efficient time

ぃ、小莉子 提交于 2019-12-05 13:41:54
I used many existing codes and I tried to zip the folder in many ways but still I am having problem with time and folder size (still approx same size). this code is from the source of the library and still not giving the wanted result static void Main(string[] args) { //copyDirectory(@"C:\x", @"D:\1"); ZipOutputStream zip = new ZipOutputStream(File.Create(@"d:\2.zip")); zip.SetLevel(9); string folder = @"D:\music"; ZipFolder(folder, folder, zip); zip.Finish(); zip.Close(); } public static void ZipFolder(string RootFolder, string CurrentFolder, ZipOutputStream zStream) { string[] SubFolders =