compression

Compressing and decompressing large size data in java?

谁说胖子不能爱 提交于 2019-12-23 01:16:10
问题 I need to compress/decompress different types of files that are contained in a Folder the size of that folder might be more than 10-11 GB. I used following code but this is taking long time to compress the data. BufferedReader in = new BufferedReader(new FileReader("D:/ziptest/expansion1.MPQ")); BufferedOutputStream out = new BufferedOutputStream( new GZIPOutputStream(new FileOutputStream("test.gz"))); int c; while ((c = in.read()) != -1) out.write(c); in.close(); out.close(); Please suggest

what is the difference between compressing image and resizing image ? android

左心房为你撑大大i 提交于 2019-12-22 12:12:38
问题 in my android app , i want to upload image to the server. the problem that the server will not accept images with size larger than 2M. but the user can choose an image larger than 2M. so I want to build a code that will make the image smaller than 2M. I have tow approaches : tow resize the image dimensions. as below : public static Bitmap decodeSampledBitmapFromResource(Resources res, int resId, int reqWidth, int reqHeight) { // First decode with inJustDecodeBounds=true to check dimensions

How to compress data in swift 3?

ぐ巨炮叔叔 提交于 2019-12-22 10:43:35
问题 I have some files in file manager in Swift 3. I want to upload them, but when I will convert them into base 64, their size will be huge! so I want to compress the data before converting it into base 64. Here is my code for converting: for i in 0...(rows?.count)! - 1 { let filePath = filesurl[fileManagerViewController.selectedFileIndex[i]] do { let fileData = try Data.init(contentsOf: filePath) let fileStream:String = fileData.base64EncodedString(options: NSData.Base64EncodingOptions.init

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

独自空忆成欢 提交于 2019-12-22 09:14:11
问题 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

using 7zip sdk to compress a file, but can not decompress using winrar or 7zip

五迷三道 提交于 2019-12-22 08:46:26
问题 I downloaded the SDK 7zip from here. Then I used this code to compress a file to 7zip: private static void CompressFileLZMA(string inFile, string outFile) { Encoder coder = new SevenZip.Compression.LZMA.Encoder(); using (FileStream input = new FileStream(inFile, FileMode.Open)) using (FileStream output = new FileStream(outFile, FileMode.Create)) { coder.Code(input, output, -1, -1, null); output.Flush(); } } I tried both the SDK versions 9.20 and 9.22 beta on the site. The compression seems

Compression issue with large archive of files in DotNetZip

≡放荡痞女 提交于 2019-12-22 08:45:00
问题 Greetings.... I am writing a backup program in c# 3.5, using hte latest DotNetZip. The basics of the program is to be given a location on a server and the max size of a spanned zip file and go. From there it should traverse all the folder/files from the given location and add them to the archive, keeping the exact structure. It should also compress everything down to a reasonable amount. A given uncompressed collection of folders/files could easily be 10-25gb, with the created spanned files

javascript text compression/decompression

◇◆丶佛笑我妖孽 提交于 2019-12-22 08:25:04
问题 Suppose I have a 400K text file which I want to read from a javascript. The problem is, my target audience have a slow connection, so 400k might take too long to load. I suppose I need to compress the file, but well, how can I decompress it via javascript on the client side? Is it worth it, or will the time needed for decompression negate the time saved in downloading? UPDATE Just to be clear, the file is text (data) not code. 回答1: You can GZip the text file, and sent it to the browser. That

Decompressing to a byte[] using GzipInputStream

大憨熊 提交于 2019-12-22 08:16:08
问题 I have a class that compresses and decompresses a byte array; public class Compressor { public static byte[] compress(final byte[] input) throws IOException { try (ByteArrayOutputStream bout = new ByteArrayOutputStream(); GZIPOutputStream gzipper = new GZIPOutputStream(bout)) { gzipper.write(input, 0, input.length); gzipper.close(); return bout.toByteArray(); } } public static byte[] decompress(final byte[] input) throws IOException { try (ByteArrayInputStream bin = new ByteArrayInputStream

Convert TIFF LZW to CCITT

微笑、不失礼 提交于 2019-12-22 08:12:47
问题 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. 回答1: 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).

GD imagejpeg() compression?

孤人 提交于 2019-12-22 08:06:04
问题 I'm working on a project where I edit the pixels of a jpg in PHP using the GD library. Its very crucial and key to my project that the output from PHP retains the pixel values I set (cough-steganography-cough). This is the first time I've attempted image manipulation in PHP. I've had no problems before in my Java implementations, so I was foolish not to investigate GD's jpeg compression quality before pursuing further. It turns out that after all my effort, my code does not function the way