compression

Compress camera image before upload

浪尽此生 提交于 2019-11-27 11:08:31
I am using this code (from www.internetria.com ) to take a photo and upload to a server: onCreate: Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); Uri output = Uri.fromFile(new File(foto)); intent.putExtra(MediaStore.EXTRA_OUTPUT, output); startActivityForResult(intent, TAKE_PICTURE); onActivityResult: ImageView iv = (ImageView) findViewById(R.id.imageView1); iv.setImageBitmap(BitmapFactory.decodeFile(foto)); File file = new File(foto); if (file.exists()) { UploaderFoto nuevaTarea = new UploaderFoto(); nuevaTarea.execute(foto); } else Toast.makeText(getApplicationContext(), "No se

PHP: How to compress images without losing visible quality (automatically)?

。_饼干妹妹 提交于 2019-11-27 10:34:40
问题 I'm wondering how to figure out the best compress rate (small filesize + no quality loss) automatically. At the moment I'm using imagejpeg() with $quality = 85 for each .jpg . PageSpeed (Chrome Plugin) suggests, to lower the quality of a few images to save some kb. The percentage of reduction is different. I'd like to write a cronjob that crawls a specific directory and optimizes every image. How does PageSpeed or TinyPNG figure out the best optimized quality and is this possible with PHP or

How do you create a .gz file using PHP?

南楼画角 提交于 2019-11-27 10:33:46
I would like to gzip compress a file on my server using PHP. Does anyone have an example that would input a file and output a compressed file? The other answers here load the entire file into memory during compression, which will cause ' out of memory ' errors on large files. The function below should be more reliable on large files as it reads and writes files in 512kb chunks. /** * GZIPs a file on disk (appending .gz to the name) * * From http://stackoverflow.com/questions/6073397/how-do-you-create-a-gz-file-using-php * Based on function by Kioob at: * http://www.php.net/manual/en/function

Creating a zipped/compressed folder in Windows using Powershell or the command line

有些话、适合烂在心里 提交于 2019-11-27 10:22:02
问题 I am creating a nightly database schema file and would like to put all the files created each night, one for each database, into a folder and compress that folder. I have a PowerShell script that creates the schema.Only creation script of the db's and then adds all the files to a new folder. The problem lies within the compression portion of this process. Does anybody have any idea if this can be accomplished with the pre-installed Windows utility that handles folder compression? It would be

Disable Asset Minification in Rails Production

血红的双手。 提交于 2019-11-27 10:18:27
问题 In order to debug javascript in my heroku production environment, I need to disable asset compression (or at least compression of javascript). I tried config.assets.compress = false along with config.assets.debug = true , and the compressed assets were still used. I then deleted the compressed assets, at which point no assets were rendered at all. I added config.assets.enabled = false , which did not help. I tried copying the uncompressed assets into various directories, including the

How do I enable gzip compression when using MVC3 on IIS7?

时光总嘲笑我的痴心妄想 提交于 2019-11-27 10:04:41
Does anybody know how to enable gzip compression in MVC 3? I'm using IIS7. Google Chrome Audit's result: Enable gzip compression (4) Compressing the following resources with gzip could reduce their transfer size by about two thirds (~92.23KB): /mydomain/ could save ~1.53KB jquery-1.4.4.min.js could save ~51.35KB Cufon.js could save ~11.89KB Futura.js could save ~27.46KB You can configure compression through your web.config file as follows: <system.webServer> <urlCompression doStaticCompression="true" doDynamicCompression="true" /> </system.webServer> You can find documentation of this

How to zip a WordprocessingML folder into readable docx

一个人想着一个人 提交于 2019-11-27 10:00:13
问题 I have been trying to write a simple Markdown -> docx parser/writer, but am completely stuck with the last part, which should be the easiest: i.e. compressing the folder into a .docx that Word, or any other .docx reader, will recognize. My parser-writer is irrelevant really: I have this problem if I simply unzip any old Word-produced *.docx and then try to recompress it with the usual compression utilities, giving it the file-ending docx. Is there some mysterious header I should be adding, or

Compact decompression library for embedded use

雨燕双飞 提交于 2019-11-27 09:53:25
问题 We're currently creating a device for a customer that will get a block of data (like, say, 5-10KB) from a PC application. This is a bit simplified, so assume that the data must be passed and uncompressed a lot, not just once a year. The communication channel is really, really slow, so we'd like to compress the data beforehand, pass to the device and let it uncompress the data to its internal flash. The device itself, however, runs on a micro controller that is not really fast and does not

Removing extra whitespace from generated HTML in MVC

寵の児 提交于 2019-11-27 09:51:49
问题 I have an MVC application view that is generating quite a large HTML table of values (>20MB). I am compressing the view in the controller using a compression filter internal class CompressFilter : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext filterContext) { HttpRequestBase request = filterContext.HttpContext.Request; string acceptEncoding = request.Headers["Accept-Encoding"]; if (string.IsNullOrEmpty(acceptEncoding)) return; acceptEncoding =

LSB-DCT based Image steganography

狂风中的少年 提交于 2019-11-27 09:48:36
I'm working on LSB-DCT based Image steganography in which i have to apply LSB to DCT coefficients of the image for data embedding to JPEG.i'm new to all this.so searched and read some research papers they all lack a lot of information regarding the process after DCT.i also read many questions and answers on stackoverflow too and got more confused. here are the questions: 1-reasearch paper and in question on the web they all are using 8x8 block size from image for DCT..what i should do if the resolution of image does not completely divides into 8x8 blocks like 724 x 520. 520 / 8 = 65 but 724 /