compression

Compress video size before attach to an email in swift

我们两清 提交于 2019-12-04 05:21:19
问题 Previous, I have ask for how to attach video then send via email. Now it working. Advised by some friend from this website. I found new problem that video size is very large and larger than send with default email app in iOS for same video file. Please advice me how to compress video file before attach to an email application. Thank you everyone. func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject]) { if let myImage = info

C# Create ZIP Archive with multiple files

▼魔方 西西 提交于 2019-12-04 05:10:03
I'm trying to create a ZIP archive with multiple text files as follows: Dictionary<string, string> Values = new Dictionary<string, string>(); using (var memoryStream = new MemoryStream()) { string zip = @"C:\Temp\ZipFile.zip"; foreach (var item in Values) { using (var archive = new ZipArchive(memoryStream, ZipArchiveMode.Create, true)) { var file = archive.CreateEntry(item.Key + ".txt"); using (var entryStream = file.Open()) using (var streamWriter = new StreamWriter(entryStream)) { streamWriter.Write(item.Value); } } } using (var fileStream = new FileStream(zip, FileMode.Create)) {

What's the name of this algorithm/routine?

末鹿安然 提交于 2019-12-04 05:06:11
I am writing a utility class which converts strings from one alphabet to another, this is useful in situations where you have a target alphabet you wish to use, with a restriction on the number of characters available. For example, if you can use lower case letters and numbers, but only 12 characters its possible to compress a timestamp from the alphabet 01234567989 -: into abcdefghijklmnopqrstuvwxyz01234567989 so 2010-10-29 13:14:00 might become 5hhyo9v8mk6avy (19 charaters reduced to 16). The class is designed to convert back and forth between alphabets, and also calculate the longest source

How to determine if a string was compressed?

末鹿安然 提交于 2019-12-04 05:04:54
How can I determine whether a string was compressed with gzcompress (aparts from comparing sizes of string before/after calling gzuncompress , or would that be the proper way of doing it) ? A string and a compressed string are both simply sequences of bytes. You cannot really distinguish one sequence of bytes from another sequence of bytes. You should know whether a blob of bytes represents a compressed format or not from accompanying metadata. If you really need to guess programmatically, you have several things you can try: Try to uncompress the string and see if the uncompress operation

Importing Python modules from a select location

强颜欢笑 提交于 2019-12-04 05:03:47
Let’s say I had three scripts. Main.py (has all imports), 1.py (random script), 2.py (random script). pyinstaller -F --onedir Main.py (80mb) pyinstaller -F --onedir 1.py (80mb) pyinstaller -F --onedir 2.py (80mb) This creates 3 folders I then copy 1.exe and 2.exe to Main folder with all dependencies and this runs fine. Two issues are present: The issue is the size. One file reduces this to 30mb, one folder keeps it at 80mb More importantly, the exe’s are unable to leave that folder. I’ve had to resort to using shortcuts in Python. I am following this , which supposedly is a workaround. My

How can I decompress a vector of deflated data with Boost?

情到浓时终转凉″ 提交于 2019-12-04 04:53:50
问题 I have a vector that contains zlib-compressed (deflated) data. I would like to decompress it with Boost's filtering_istream . There is only one example on their site, which operates on a stream of data (as opposed to a vector that I have). vector<char> compressed_buffer; compressed_buffer.resize(cdh.length); file.read(&compressed_buffer[0], cdh.length); filtering_istream in; in.push(zlib_decompressor()); in.push(something(compressed_data)); // what should "something" be? I would like to get

How to inflate a partial zlib file

徘徊边缘 提交于 2019-12-04 04:29:59
I have the first contiguous 2/3rds of a file that was compressed with zlib's deflate() function. The last 1/3 was lost in transmission. The original uncompressed file was 600KB. Deflate was called multiple times by the transmitter while chopping the original file into chunk sizes of 2KB and passing Z_NO_FLUSH until the end of file when Z_FINISH was passed. The resulting complete compressed file was transmitted, but partially lost as described. Is it possible to recover part of the original file? If so, any suggestions on how? I'm using both the plain C implementation of ZLIB, and/or the Python

Is it possible to further compress a Base64 PNG String?

不想你离开。 提交于 2019-12-04 04:23:08
I have a PNG image and got its Base64 PNG string representation. It's still quite large and i'd like to know if it can be significantly further compressed. Is that even possible? Background I am using Selenium 2 (Java) to create a screenshot of the current web page, convert it as base64 string and send that string to the JavaScript executor to recreate that image and do some image processing. But if that string size is too large, the server returns an Exception. The simple answer: No - not without loosing the "printable string" nature Usually PNG already uses sophisticated compression like it

Reduce file size of an image

雨燕双飞 提交于 2019-12-04 04:05:58
问题 I have taken a picture with the android camera. The result is an byte array. I save it by writing it on the sdcard (FileOutputStream). The result is an image with a filesize of nearly 3mb. I would like to reduce this filesize, so compress the image. It would be nice if it is possible to reduce the filesize before i would write the byte array to the output stream. Is that possible or do I have to save it first? 回答1: I usually resize the image which reduces the size of it Bitmap bitmap =

How to extract a rar file in C#?

安稳与你 提交于 2019-12-04 03:49:59
问题 I want to extract .rar files using cmd shell so I wrote this code: string commandLine = @"c:\progra~1\winrar\winrar e c:\download\TestedU.rar c:\download"; ProcessStartInfo PSI = new ProcessStartInfo("cmd.exe"); PSI.RedirectStandardInput = true; PSI.RedirectStandardOutput = true; PSI.RedirectStandardError = true; PSI.UseShellExecute = false; Process p = Process.Start(PSI); StreamWriter SW = p.StandardInput; StreamReader SR = p.StandardOutput; SW.WriteLine(commandLine); SW.Close(); The first