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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T15:48:56+00:00 2026-05-21T15:48:56+00:00

I am looking for a simple and efficient way to give a special tint

  • 0

I am looking for a simple and efficient way to give a special tint to any icon contained in an NSImage. My initial need id to have sepia icons but if can use other colors it is better.

Do you have any idea to achieve this?

Thanks in advance for your help,

Regards,

  • 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-21T15:48:56+00:00Added an answer on May 21, 2026 at 3:48 pm

    I think you will have take image pixel by pixel and adjust rgb values to get the effect.

    -(UIImage*)makeSepiaScale:(UIImage*)image
    {
        CGImageRef cgImage = [image CGImage];
        CGDataProviderRef provider = CGImageGetDataProvider(cgImage);
        CFDataRef bitmapData = CGDataProviderCopyData(provider);
        UInt8* data = (UInt8*)CFDataGetBytePtr(bitmapData); 
    
        int width = image.size.width;
        int height = image.size.height;
        NSInteger myDataLength = width * height * 4;
    
    
        for (int i = 0; i < myDataLength; i+=4)
        {
            UInt8 r_pixel = data[i];
            UInt8 g_pixel = data[i+1];
            UInt8 b_pixel = data[i+2];
    
            int outputRed = (r_pixel * .393) + (g_pixel *.769) + (b_pixel * .189);
            int outputGreen = (r_pixel * .349) + (g_pixel *.686) + (b_pixel * .168);
            int outputBlue = (r_pixel * .272) + (g_pixel *.534) + (b_pixel * .131);
    
            if(outputRed>255)outputRed=255;
            if(outputGreen>255)outputGreen=255;
            if(outputBlue>255)outputBlue=255;
    
    
            data[i] = outputRed;
            data[i+1] = outputGreen;
            data[i+2] = outputBlue;
        }
    
        CGDataProviderRef provider2 = CGDataProviderCreateWithData(NULL, data, myDataLength, NULL);
        int bitsPerComponent = 8;
        int bitsPerPixel = 32;
        int bytesPerRow = 4 * width;
        CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB();
        CGBitmapInfo bitmapInfo = kCGBitmapByteOrderDefault;
        CGColorRenderingIntent renderingIntent = kCGRenderingIntentDefault;
        CGImageRef imageRef = CGImageCreate(width, height, bitsPerComponent, bitsPerPixel, bytesPerRow, colorSpaceRef, bitmapInfo, provider2, NULL, NO, renderingIntent);
    
        CGColorSpaceRelease(colorSpaceRef); // YOU CAN RELEASE THIS NOW
        CGDataProviderRelease(provider2); // YOU CAN RELEASE THIS NOW
        CFRelease(bitmapData);
    
        UIImage *sepiaImage = [UIImage imageWithCGImage:imageRef];
        CGImageRelease(imageRef); // YOU CAN RELEASE THIS NOW
        return sepiaImage;
    }
    

    Code is shamelessly copied from this SO thread , and it talks about applying sepia filter to UIImage instead of NSImage, but logic can be reused..Also this thread is one of the best when it comes to image processing..One to bookmark..

    Edit: As Josh Caswell pointed out, Core Image can be used to create sepia image and some image filtering..So easier method should be to use core Image…Read his answer on how to do it..This method works fine too, especially in iphone where there is no coreImage framework..

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

Sidebar

Related Questions

I'm looking for an efficient way to achieve this: you have a list of
I am looking for the most efficient/direct way to do this simple C/C++ operation:
I'm looking for a simple, efficient way to convert strings in CamelCase to underscore
Simple question I suspect, but nonetheless: I'm looking for an efficient way to grab
I have a simple CMS running PHP/MySQL and I'm looking for the most efficient
I'm looking for the most efficient/simple way to run a script (we'll call it
I'm looking for a simple, clean and memory-efficient way to create and apply a
I'm looking for a simple and efficient way to solve the following problem: I
I'm looking for a simple, efficient way to get the position of the browser
I am looking for a simple but efficient Objective-C algorithm which, starting from a

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.