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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:31:32+00:00 2026-06-15T06:31:32+00:00

I m trying to change color space for image objects of a pdf file,

  • 0

I m trying to change color space for image objects of a pdf file, but first problem is that I cannot find ICC color profile inside pdf metadata.

All I have in Metadata is one array with 2 components:

ColorSpace :
    Name value: ICCBased
    Stream value (null) 

And when I get the Stream parsed into a dictionary:

Color Space Name ICCBased
  Filter :
    Name value: FlateDecode
  Length :
   integer value: 389757 
  N :
   integer value: 4 
  Range :
   ARRAY with value:
    integer value: 0 
    integer value: 1 
    integer value: 0 
    integer value: 1 
    integer value: 0 
    integer value: 1 
    integer value: 0 
    integer value: 1 

But I am unable to find in metadata the ICC profile data used on the color space of the image, the one you can see with acrobat:

enter image description here

By the way, if you are interested on how to get metadata form pdf file with coreGraphics here I put some code:

…

CGPDFDocumentRef pdfDocument = CGPDFDocumentCreateWithURL(pdfURL);

CGPDFPageRef page = CGPDFDocumentGetPage(pdfDocument, pageNumber);

CGPDFContentStreamRef contentStream =

CGPDFContentStreamCreateWithPage(page); CGPDFOperatorTableRef

operatorTable = CGPDFOperatorTableCreate();

CGPDFOperatorTableSetCallback(operatorTable, “Do”, &op_Do);

CGPDFScannerRef contentStreamScanner =

CGPDFScannerCreate(contentStream, operatorTable, NULL);

CGPDFScannerScan(contentStreamScanner);

….

And then on the callback:

static void op_Do(CGPDFScannerRef s, void *info) {

CGPDFObjectRef imageObject = CGPDFContentStreamGetResource(cs, “XObject”, imageLabel);

CGPDFStreamRef xObjectStream;

if (CGPDFObjectGetValue(imageObject, kCGPDFObjectTypeStream, &xObjectStream)) {

    CGPDFDictionaryRef xObjectDictionary = CGPDFStreamGetDictionary(xObjectStream);

    const char *subtype;

    CGPDFDictionaryGetName(xObjectDictionary, "Subtype", &subtype);

    if (strcmp(subtype, "Image") == 0) {

        NSString *imageID = [NSString stringWithCString: imageLabel encoding: NSASCIIStringEncoding];

        CGPDFDictionaryApplyFunction(xObjectDictionary, ListDictionaryObjects, NULL);

if (CGPDFDictionaryGetName(xObjectDictionary, “ColorSpace”, &colorSpaceName)){

            fprintf(stdout,"Color Space Name %s\n", colorSpaceName);

}else{

            //Getting Color space array
            CGPDFArrayRef objectArray;

            CGPDFDictionaryGetArray(xObjectDictionary, "ColorSpace", &objectArray);
            //getting each array position             
            CGPDFStreamRef colorsSpaceStream;

            CGPDFArrayGetName(objectArray, 0, &colorSpaceName);

            fprintf(stdout,"Color Space Name %s\n", colorSpaceName);

            CGPDFArrayGetStream(objectArray, 1, &colorsSpaceStream);

            CGPDFDictionaryRef dictionary = CGPDFStreamGetDictionary(colorsSpaceStream);

            CGPDFDictionaryApplyFunction(dictionary, ListDictionaryObjectsLow, NULL);

}

…

And finally in ListDictionaryObjects functions I go through dictionary objects:

void ListDictionaryObjects (const char *key, CGPDFObjectRef object, void *info) {
fprintf(stdout, “%s :\n”, key);

CGPDFObjectType type = CGPDFObjectGetType(object);
switch (type) {
    case kCGPDFObjectTypeDictionary: {
        CGPDFDictionaryRef objectDictionary;
        if (CGPDFObjectGetValue(object, kCGPDFObjectTypeDictionary, &objectDictionary)) {
            fprintf(stdout," Dictionary value with: %zd elements\n", CGPDFDictionaryGetCount(objectDictionary));
            CGPDFDictionaryApplyFunction(objectDictionary, ListDictionaryObjectsLow, NULL);
        }
    }
        break;
    case kCGPDFObjectTypeInteger: {
        CGPDFInteger objectInteger;
        if (CGPDFObjectGetValue(object, kCGPDFObjectTypeInteger, &objectInteger)) {
           fprintf(stdout," integer value: %ld \n", (long int)objectInteger);
        }

    }
    break;
    case kCGPDFObjectTypeReal:{
        CGPDFReal objectReal;
        if (CGPDFObjectGetValue(object, kCGPDFObjectTypeReal, &objectReal)){
            fprintf(stdout," real value: %5.2f\n", objectReal);
        }
    } ...
  • 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-15T06:31:33+00:00Added an answer on June 15, 2026 at 6:31 am

    Assigning a new color profile (i.e. without altering values in the object) to all objects of a certain color space can be done by creating a Quartz Filter with ColorSync Utility.

    A technical note from the Mac Developer Library from 2005 about “ColorSync on Mac OS X” stated:

    Quartz filters are currently available only through the various Mac OS X system-built utilities and applications. However, a new set of API’s will be forthcoming.

    But I could not find any other mention to Quartz Filters in Apple’s documentation for developers.

    I know this is not terribly helpful, but maybe it gives you a hint of were to look.

    Edit: See this answer to “Apply a Quartz filter while saving PDF under Mac OS X 10.6.3”

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

Sidebar

Related Questions

I'm trying to change the color of graticule labels on my openlayers map but
i'm trying to change the color of the tabbar with a custom color but
I'm trying to change the color of the Asterisk but I can't target the
I am actually trying to change the color index for the first word with
Please see the attached image. I'm trying to change the color on the segmented
I am trying to change color using getColor(String name) function but it seems not
I'm trying to change color of an image in a background thread. Apple doc
Trying to change a div background color when hover over another div. But I
I am just trying to change color of textview on notifydatasetchanged but it is
i am trying to change color of titlebar but as onncpaint is not supported

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.