views:

235

answers:

3

I have an online tool through which another user upload photos. The user is having issues when using slower bandwidth.

I found this http://en.wikipedia.org/wiki/Lossless%5Fdata%5Fcompression

1) Is there any tool or API that utilizes this algorithm?

2) Will it slow the upload process for being able to compress locally?

+1  A: 

Jpegs are already compressed. If you try and zip a jpeg it won't shrink intact it will grow ever so slightly due to metadata belonging to the zip file format.

mP
-1 for being wrong. 1. JPEGs specify their own level of compression and may not even be compressed at all. 2. JPEG compression is generally lossy. Applying non-lossy compression such as ZIP after lossy compression can still give a benefit. 3. It's innacurate to say that it *will* grow. Non-lossy compression is probablistic so there's still a chance that there might be some shrinkage, even on already-compressed data. Conclusion: it would be more accurate to say that the decrease in size is likely to be too small to provide an appreciable benefit in upload time.
Imagist
Imagist - i omitted the very same information that you are including as the main goal of the answer was to highlight the futility of attempting to compress jpgs. Most of the time its just not worth the bother. You could also re-compress the image with more "loss" for a smaller file size.
mP
@ImagistWhatever positive benefits of re-encoding etc, the real problem is the user probably cant practically upload the files they wish to upload. A few percentage points are not really going to make that much difference. A different strategy needs to be considered to solve this problem.The question is poorly worded and missing lots of details. Can we assume the user is using a browser to upload the photos ? Most of the time users dont have a clue about doing extra stuff they just want a one step process.
mP
+1  A: 

WinZip is an example of a tool that does lossless data compression... However, you are probably wasting your time since you will hardly find any lossless compression that does more than a 1-10% size reduction. If at all!

All in all you will be pressed to get any noteable change in the upload process - except for getting it to take VERY long if you really, really want to compress the heck out of your file.

I think, your best chance is to recompress and/or resize the image if necessary.

dionadar
I only brought up Winzip to demonstrate the futility of attempting to compress something thats already been compressed - without loss.Naturally the only option is to compress the jpg at a lower quality for more loss in quality etc.
mP
Of course! I never saw your answer before mine was done, so sorry if it looks like I was trying to poke fun at you, that never was intended!
dionadar
A: 

Compression takes time. If it takes X time to upload and it takes Y time to compress for a Z percentage decrease in size, then your goal is to get Y + X - Z*X < X. Given the human time necessary to even open up a compression program, Y is likely to be a very large number comparably, and it's highly unlikely that you're going to gain any benefit.

Your best bet is some form of lossy compression. An excellent lossy compression program is a simple picture editor that allows you to crop and resize. If you can cut out the parts of the image you don't want and remove the resolution information that is unnecessary, you might be able to get an appreciable difference in size.

Still, my recommendation is simply to shell out the extra cash for a decent internet connection. Cable or even satellite isn't that much more expensive than dialup these days.

Imagist
The idea is probably to do the compression automatically...
dionadar
@Imagist: There are Internet users who live where wired broadband service is not available, there are Internet users who live where wired or satellite broadband is available, but the cost is prohibitively high, and there are Internet users who live where wired or satellite broadband is available and "affordable" (by some definition) but they do not value Internet access highly enough to pay the difference in price between a dial-up account and a broadband one. Only the last group meets your criteria, and they shouldn't have to change their value system to have a reasonable Internet experience.
Grant Wagner
@Grant-Wagner Supporting dialup-connection-speeds on a website is like supporting bikes on a road system. Yes, it's a good thing to do for many reasons. But you have to recognize that there are some tasks for which a dialup-connection or a bike are not appropriate. It's unreasonable to have a bike lane on a 70 MPH highway. Sure, there are things you could do to help bikes go faster, but in the end, if you want to go 70 MPH you need something motorized. Yes, not everyone can afford a car, but we can't reasonably just make reality fit to what they want.
Imagist
@Grant-Wagner (continued) You can do a lot to help users on low-bandwidth connections: compress your images, use fewer images, strip whitespace from your HTML/Javascript/CSS, etc. But you can't really make JPEGs much smaller. I'm not saying that they should get a better internet connection because I don't feel for their plight, I'm saying it because that's the only solution that works.
Imagist