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 8500017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:49:31+00:00 2026-06-11T00:49:31+00:00

OK this is what I want : Take some NSImage s Add them to

  • 0

OK this is what I want :

  • Take some NSImages
  • Add them to an ICNS file
  • Save it

This is what I’ve done so far (purely as a test) :

- (CGImageRef)refFromImage:(NSImage*)img
{
    CGImageSourceRef source;

    source = CGImageSourceCreateWithData((CFDataRef)[img TIFFRepresentation], NULL);
    CGImageRef maskRef =  CGImageSourceCreateImageAtIndex(source, 0, NULL);

    return maskRef;
}

- (void)awakeFromNib
{
    NSImage* img1 = [NSImage imageNamed:@"image1"];
    NSImage* img2 = [NSImage imageNamed:@"image2"];

    NSLog(@"%@",img1);
    CGImageRef i1 = [self refFromImage:img1];
    CGImageRef i2 = [self refFromImage:img2];

    NSURL *fileURL = [NSURL fileURLWithPath:[@"~/Documents/final.icns" stringByExpandingTildeInPath]]; 
    CGImageDestinationRef dr = CGImageDestinationCreateWithURL((__bridge CFURLRef)fileURL, kUTTypeAppleICNS , 1, NULL);

    CGImageDestinationAddImage(dr, i1, NULL);
    CGImageDestinationAddImage(dr, i2, NULL);
    /* Even tried adding 'multiple' times

    CGImageDestinationAddImage(dr, i1, NULL);
    CGImageDestinationAddImage(dr, i2, NULL);
    CGImageDestinationAddImage(dr, i1, NULL);
    CGImageDestinationAddImage(dr, i2, NULL);

    */

    CGImageDestinationFinalize(dr);

    CFRelease(dr);
}

But, it still keeps throwing an error :

ImageIO: CGImageDestinationFinalize image destination does
not have enough images

What’s wrong with my code?


I’ve had a look at the answers below, but still nothing :

  • Save CGImageRef to PNG file errors? (ARC Caused?)
  • How exactly to make a CGImageRef from an image on disk
  • 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-06-11T00:49:32+00:00Added an answer on June 11, 2026 at 12:49 am

    You can use IconFamily.

    IconFamily is a Cocoa/Objective-C wrapper for the Mac OS X Carbon
    API’s “icon family” data type. Its main purpose is to enable Cocoa
    applications to easily create custom file icons from NSImage
    instances, and thus take advantage of Mac OS X’s high-resolution RGBA
    “thumbnail” icon formats to provide richly detailed thumbnail previews
    of the files’ contents.

    NSImage *mImage = [[NSImage alloc] initWithContentsOfFile:@"/Users/Username/Desktop/WhiteTiger.jpg"];
    IconFamily *fam = [IconFamily iconFamilyWithThumbnailsOfImage:mImage];    
    [fam writeToFile:@"/Users/Username/Desktop/WhiteTiger.icns"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to take some data, in this case an XML, and create a
I want to take some data, update/create an xml file with it in node.
I want to take some information from opencv program and then store them in
I want to take some indices from the elements of a numpy.array. This is
Anyone want to take a stab at why this bookmarklet fails in IE8? It
This should be an absurdly easy task: I want to take each line of
This is probably crazy. I want to take the idea of Dependency Injection to
This is strange. In the news details page, I want to take a few
I know it is quite subjective, but I also want to take this opportunity
What I want to do is take a numpy array like this: [[1, 2,

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.