• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to incrementally compress jpeg?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to incrementally compress jpeg?


  • Subject: Re: How to incrementally compress jpeg?
  • From: Phi Le <email@hidden>
  • Date: Fri, 20 Nov 2009 14:20:04 -0800

I am coming from a .NET C# background, so I have some expectations
that might not apply to Cocoa development.  In .NET, I can
incrementally compress an image like this:
A = new Image(data)
B = A.save(JPEGType, 0.5)
C = B.save(JPEGType, 0.5)

where the sizes A > B > C and the deltas are significant.  I can do
this if B is saved to disk and reload back.
So if I am given an NSImage, but not the backing NSData directly,  can
I ask the NSImage, NSImageRep or something else to give me information
about the original data, filetype, compression factor ?

Phi


On Fri, Nov 20, 2009 at 2:05 PM, Jens Alfke <email@hidden> wrote:
>
> 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 (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: How to incrementally compress jpeg?
      • From: Scott Ribe <email@hidden>
    • Re: How to incrementally compress jpeg?
      • From: Jens Alfke <email@hidden>
References: 
 >How to incrementally compress jpeg? (From: Phi Le <email@hidden>)
 >Re: How to incrementally compress jpeg? (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Magic Mouse and NSTouch
  • Next by Date: Re: What exactly does NSController do?
  • Previous by thread: Re: How to incrementally compress jpeg?
  • Next by thread: Re: How to incrementally compress jpeg?
  • Index(es):
    • Date
    • Thread