On Nov 20, 2009, at 1:47 PM, Phi Le wrote:

I have an jpeg image and I want to be able to incrementally compress
it using Cocoa/Core Image/Core Graphics.  For example, I have A.jpg
(3MB), I compress A and get B.jpg (1MB), compress B and get C.jpg
(400KB), and so on till the image can't be compressed anymore.

What you're doing doesn't make sense; image compression doesn't work that way. If you JPEG-encode a pixmap, then load it back into an image, you have another pixmap. Compressing the resulting pixmap isn't going to result in smaller data just because you decompressed it from a smaller block of data.

If you want to experiment with progressively greater and greater compression levels, you have to start with the same source pixmap every time and gradually decrease the compression factor. (For example, I did this in iChat to compress the user's buddy icon down to under 2K to fit in a Bonjour record. There's a loop that keeps increasing the compression factor until the data size is small enough.)

—Jens_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to