image-compression

Code Golf: 1x1 black pixel

限于喜欢 提交于 2019-12-02 21:08:43
Recently, I used my favorite image editor to make a 1x1 black pixel (which can come in handy when you want to draw solid boxes in HTML cheaply). Even though I made it a monochrome PNG, it came out to be 120 bytes! I mean, that's kind of steep. 120 bytes. For one pixel . I then converted it to a GIF, which dropped the size down to 43 bytes. Much better, but still... Challenge The shortest image file or program that is or generates a 1x1 black pixel. A submission may be: An image file that represents a 1x1 black pixel. The format chosen must be able to represent larger images than 1x1, and

Android : How to convert the compressed images to string with minimum size

故事扮演 提交于 2019-12-02 19:15:04
问题 In my android application i am using whatsapp like image compression and after that i convert the compressed image bitmap to string using Base64 encoding,what i noticed is that when i compress a 5mb image and save it in another locations its just of 60kb or 70kb something like that and the Base64 encoded string is taking 500kb or 600kb for the same image, why its like that? Is there any way to convert the compressed image to string with its same size.Below is my code. Bitmap bitmapImg; if

Android : How to convert the compressed images to string with minimum size

≯℡__Kan透↙ 提交于 2019-12-02 12:35:32
In my android application i am using whatsapp like image compression and after that i convert the compressed image bitmap to string using Base64 encoding,what i noticed is that when i compress a 5mb image and save it in another locations its just of 60kb or 70kb something like that and the Base64 encoded string is taking 500kb or 600kb for the same image, why its like that? Is there any way to convert the compressed image to string with its same size.Below is my code. Bitmap bitmapImg; if (requestCode == FILE_SELECT_CODE) { if(data!= null) { try { Uri selectedImageUri = data.getData(); String

How to apply orthogonal polynomial transformation on an image for image compression?

杀马特。学长 韩版系。学妹 提交于 2019-12-02 08:43:10
I am working on Image compression based on orthogonal polynomial transformation. My input image is gray scale image of size 256*256. i divide this image into 4 by 4 blocks. and than apply the orthogonal polynomial operator on each block. but I am not getting correct coefficient. Example: If I have a block 4x4 of Input image: I=[5 11 8 10;9 8 4 12; 1 10 11 4;19 6 15 7]; and my polynomial operator for n=4 is: [M] = [p0 p1 p2 p3]=[1 -3 1 -3;1 -1 -1 9;1 1 -1 -9;1 3 1 3] After finding the outer product: [20 -24 24 -16; -24 84 -80 24;24 -80 84 -24;-16 24 -24 20] when I applied this on input image

Using Huffman coding to compress images taken by the iPhone camera

a 夏天 提交于 2019-12-02 06:31:15
Im thinking to use the Huffman coding to make an app that takes pictures right from the iPhone camera and compress it. Would it be possible for the hardware to handle the complex computation and building the tree ? In other words, is it doable? Thank you If you mean the image files (like jpg, png, etc), then you should know that they are already compressed with algorithms specific to images. The resulting files would not huffman compress much, if at all. If you mean that you are going to take the UIImage raw pixel data and compress it, you could do that. I am sure that the iPhone could handle

Calling imageWithData:UIImageJPEGRepresentation() multiple times only compresses image the first time

半世苍凉 提交于 2019-11-30 16:21:49
In order to prevent lagging in my app, I'm trying to compress images larger than 1 MB (mostly for pics taken from iphone's normal camera. UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage]; NSData *imageSize = UIImageJPEGRepresentation(image, 1); NSLog(@"original size %u", [imageSize length]); UIImage *image2 = [UIImage imageWithData:UIImageJPEGRepresentation(image, 0)]; NSData *newImageSize = UIImageJPEGRepresentation(image2, 1); NSLog(@"new size %u", [newImageSize length]); UIImage *image3 = [UIImage imageWithData:UIImageJPEGRepresentation(image2, 0)]; NSData

Using SVD to compress an image in MATLAB

匆匆过客 提交于 2019-11-30 10:48:50
问题 I am brand new to MATLAB but am trying to do some image compression code for grayscale images. Questions How can I use SVD to trim off low-valued eigenvalues to reconstruct a compressed image? Work/Attempts so far My code so far is: B=imread('images1.jpeg'); B=rgb2gray(B); doubleB=double(B); %read the image and store it as matrix B, convert the image to a grayscale photo and convert the matrix to a class 'double' for values 0-255 [U,S,V]=svd(doubleB); This allows me to successfully decompose

Compress Image in android

冷暖自知 提交于 2019-11-30 05:21:18
I am making an application which takes image from the camera and then email it. Friends since you know that images from camera may be of too much resolution and in size as well e.g. 2.0MB and more so what i want is to re-size the image in size as well as in resolution so that i could attach that file to the email. So can anybody give me some code sample or some guidelines to get over my problem. Thanks in advance you can do this to compress BitMap.. mBitmap = Bitmap.createScaledBitmap(mBitmap, 160, 160, true); try this example public class bitmaptest extends Activity { @Override public void

Image Compression tools via command line [closed]

给你一囗甜甜゛ 提交于 2019-11-29 18:48:34
I'm searching best tool to compress images (png and jpeg) via command line. After googling I found trimage which is good as it compresses both png and jepeg, but compression ratio is very poor in this case. I came across jpeg-optimizer.com online tool which does the job way better than trimage. Can any one help to find the right tool for this. I'm using the following tools to perform lossless image compression: pngcrush gifsicle jpegtran For each of the programs, I've created two shortcuts: One that does the actual compression, and shows the file size of both files One that replaces the

How can I compress images using java?

陌路散爱 提交于 2019-11-29 10:19:19
From pagespeed I am getting only image link and possible optimizations in bytes & percentage like, Compressing and resizing https://example.com/…ts/xyz.jpg?036861 could save 212KiB (51% reduction). Compressing https://example.com/…xyz.png?303584508 could save 4.4KiB (21% reduction). For an example I have image of size 300kb and for this image pagespeed is displaying 100kb & 30% of reduction. This is only for one image but I am sure I will have lots of images for compression. so how can I compress image by passing bytes or percentage as a parameter or using anyother calculations in java (by