Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6806641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:44:10+00:00 2026-05-26T19:44:10+00:00

I have successfully been using CGImageSource to read an image in (mostly JPEG) and

  • 0

I have successfully been using CGImageSource to read an image in (mostly JPEG) and CGImageDestination to write it back out. It works but my image comes out a lot smaller than it was before (a 3.9Mb image will become a 2.1 Mb image).

I have been playing around with kCGImageDestinationLossyCompressionQuality and while it does affect the size of the file, I don’t understand the scale it uses.

E.g. that same 3.7Mb file will change its size to:

  • 1.9Mb with a compression quality of 0.7

  • 2.4Mb with a compression quality of 0.8

  • 3.0Mb with a compression quality of 0.9

  • 7.4Mb with a compression quality of 1.0

I tried everything (going to 6 decimals using dichotomy) to find the sweet spot to get back to that magic 3.9Mb but it jumps from 3.3Mb to 7.4Mb with seemingly no way to get it to stay in between these 2 numbers.

Is there any other Objective-C library I can use to modify EXIF data that leaves the compression (and thus the file size) alone?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T19:44:10+00:00Added an answer on May 26, 2026 at 7:44 pm

    Using CGImageDestination you are creating a new image, and it’s very difficult that the size of the newly created image matches the original one. (depends on the compression level).

    If you need just to modify the metadata in the original picture, without changing the image information, you should use another library. I know two of them which can be used in a cocoa app:

    • libexif C++ library. Supports writing jpgs. LGPL license.
    • exiv2 C++. Supports writing to a lot of formats. But it neeeds a
      payed license if you are using it in a commercial app.

    Another option is to use exiftool. It’s a perl scripts that has become the de-facto standard for changing metadata information. You could include it in the resources folder of your app, and invoke it using NSTask to change the metadata of the pictures. Quite easy to do, and by far the best tool of the three. (Only for mac, not sure if you’re targetting iphone or Mac)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been using Hibernate very successfully, but today I noticed a bizarre phenomenon
I have been using the XML package successfully for extracting HTML tables but want
All these years i have been successfully using EnumServicesStatus in combination with OpenScManager (with
I have a Linq-To-Sql based repository class which I have been successfully using. I
I have been successfully using my code with the javascript library in the ANTLR
For a few months I have been successfully using David Justices Default Button example
I have a library that I have been using successfully with PHP 5.1.6 with
I've been using repositories for data access for some time now but have never
We have been successfully using protobuf-net v1 in a compact framework application to handle
I have been successfully debugging several projects using Eclipse 3.4.1 with Zend Debugger and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.