• 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: Jens Alfke <email@hidden>
  • Date: Fri, 20 Nov 2009 15:22:08 -0800


On Nov 20, 2009, at 2:20 PM, Phi Le wrote:

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.

Weird — the save method must be looking up the original compression factor from the JPEG metadata and then multiplying your requested scale factor by that. I would think that would be the wrong thing to do most of the time: if I write some code that takes an image object and wants to save it to disk as a JPEG, I want to be able to specify the compression factor to use without having it be based on the pre- existing history of the file the image came from.


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 ?

I don't think the NSImage retains that amount of information about the source of the image. You might be able to use Quartz's CGImage APIs to do something like that, though.


It would be a lot easier to take a single image and just repeatedly convert it to JPEG with decreasing compression factors.

—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


References: 
 >How to incrementally compress jpeg? (From: Phi Le <email@hidden>)
 >Re: How to incrementally compress jpeg? (From: Jens Alfke <email@hidden>)
 >Re: How to incrementally compress jpeg? (From: Phi Le <email@hidden>)

  • Prev by Date: Fwd: UI Question: Hide application window after minimising
  • Next by Date: Re: How to incrementally compress jpeg?
  • Previous by thread: Re: How to incrementally compress jpeg?
  • Next by thread: Re: How to incrementally compress jpeg?
  • Index(es):
    • Date
    • Thread