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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:44:13+00:00 2026-06-14T06:44:13+00:00

I need to change the white skin face to dark skin face… For example

  • 0

I need to change the white skin face to dark skin face…
For example American white face to African face(i.e color tone)…

I pick the color value of the pixel by digital color meter it gives the RGB value[red=101,green=63 and blue=43] for dark skin and for white skin it gives the RGB value as [red=253,green=210 and blue=176]…

Then i am setting that value in my code it gives the false result…

Here is my code…

   -(UIImage*)customBlackFilterOriginal
{
    CGImageRef imgSource=self.duplicateImage.image.CGImage;
    CFDataRef m_DataRef1 = CGDataProviderCopyData(CGImageGetDataProvider(imgSource)); 
    UInt8 *dataOriginal=(UInt8 *)CFDataGetBytePtr(m_DataRef1);
    double lengthSource=CFDataGetLength(m_DataRef1);
    NSLog(@"length::%f",lengthSource);
    int redPixel;
    int greenPixel;
    int bluePixel;

    for(int index=0;index<lengthSource;index+=4)
    {

        dataOriginal[index]=dataOriginal[index];
        dataOriginal[index+1]= 101;
        dataOriginal[index+2]= 63;
        dataOriginal[index+3]=43;      

    } 

    NSUInteger width =CGImageGetWidth(imgSource);
    size_t height=CGImageGetHeight(imgSource);
    size_t bitsPerComponent=CGImageGetBitsPerComponent(imgSource);
    size_t bitsPerPixel=CGImageGetBitsPerPixel(imgSource);
    size_t bytesPerRow=CGImageGetBytesPerRow(imgSource);

    NSLog(@"the w:%u H:%lu",width,height);

    CGColorSpaceRef colorspace=CGImageGetColorSpace(imgSource);
    CGBitmapInfo bitmapInfo=CGImageGetBitmapInfo(imgSource);
    CFDataRef newData=CFDataCreate(NULL,dataOriginal,lengthSource);
    CGDataProviderRef provider=CGDataProviderCreateWithCFData(newData);
    CGImageRef newImg=CGImageCreate(width,height,bitsPerComponent,bitsPerPixel,bytesPerRow,colorspace,bitmapInfo,provider,NULL,true,kCGRenderingIntentDefault);

    return [UIImage imageWithCGImage:newImg];

}

please share any idea about the above color changing….
what mistake i did in the code?..

enter image description here

  • 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-14T06:44:14+00:00Added an answer on June 14, 2026 at 6:44 am

    I am not an IPhone programmer so I can’t test anything but some things are odd in your code:

    Pixel size
    When reading your data, you seem to assume you have a 32bits ARGB picture, did you validate it’s the case?

    CFDataGetBytePtr
    According to the docs, it Returns a read-only pointer to the bytes of a CFData object., are you sure you’re not looking for CFDataGetBytes which Copies the byte contents of a CFData object to an external buffer. In which case you’ll have to allocate your buffer to contain width * height * bpp. Once you have this copy, you can manipulate it anyway you want to create the new picture.

    Pixel Selection
    According to your question, I seem to understand that you want to change skin color from White to Black. Your current code iterates over every pixel to change its color. You should evaluate the “distance” between the pixel color and what you’re looking for, and if it’s below a certain threshold process it. It might be easier to perform the operation in HSV than by dealing with RGB colors.

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

Sidebar

Related Questions

i need change color of SystemTray.ProgressIndicator color, how i can do it? I tried
I'm working on WinForms project. I need to change color of my form from
Hello I need to change this expression so it ignores white space preg_match(/([a-zA-Z\s]{2,}\,\s)+(RED|BLUE|GREEN|BLACK)$/i,$query, $matches))
I need to change the background color of a TextView. the font color using
To make my UITableView looks better, I need to change the background color of
Although this seems like a simple task, I need to change the background color
I need to change the color of an image on a website. The image
I need change first image in Galleria fullscreen theme ( link ) after Galleria.run().
I need change background of all text that have two spaces from the start
I have database, and in one the tables I need change the values of

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.