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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:42:44+00:00 2026-05-28T05:42:44+00:00

I have implemented changing the brightness of an image using uislider in iPhone without

  • 0

I have implemented changing the brightness of an image using uislider in iPhone without using openGlImageProcessing. I want to change the brightness of particular area of an image only not the whole image, only particular area of an image should be get brightnessed for example the central area of an image should get brightnessed or particular color from an entire image should get brightnessed. How can we change the brightness of particular portion of an image. Please help me to solve the problem, code is

CGImageRef imageRef = imageView.image.CGImage;
CFDataRef ref = CGDataProviderCopyData(CGImageGetDataProvider(imageRef)); 
UInt8 * buf = (UInt8 *) CFDataGetBytePtr(ref); 
int length = CFDataGetLength(ref);

NSLog(@"%i",val);
float value = val/100;
for(int i=0; i<length; i+=3)
{
    Byte tempR = buf[i + 1];
    Byte tempG = buf[i + 2];
    Byte tempB = buf[i + 3];

    int outputRed = value + tempR;
    int outputGreen = value + tempG;
    int outputBlue = value + tempB;

    if (outputRed>255) outputRed=255;
    if (outputGreen>255) outputGreen=255;
    if (outputBlue>255) outputBlue=255;

    if (outputRed<0) outputRed=0;
    if (outputGreen<0) outputGreen=0;
    if (outputBlue<0) outputBlue=0;


    buf[i + 1] = outputRed; 
    buf[i + 2] = outputGreen; 
    buf[i + 3] = outputBlue;


}

size_t width = CGImageGetWidth(imageRef);
size_t height = CGImageGetHeight(imageRef);
size_t bitsPerComponent = CGImageGetBitsPerComponent(imageRef);
size_t bytesPerRow = CGImageGetBytesPerRow(imageRef);
CGColorSpaceRef colorSpace = CGImageGetColorSpace(imageRef);


CGContextRef ctx = CGBitmapContextCreate(buf, width, height, bitsPerComponent, bytesPerRow, colorSpace, CGImageGetAlphaInfo(imageRef));

CGImageRef img = CGBitmapContextCreateImage(ctx);
if (value == 0) {
    imageView.image = image;
}
else
{
    [imageView setImage:[UIImage imageWithCGImage:img]];
}

CFRelease(ref);
CGContextRelease(ctx);
CGImageRelease(img);    
  • 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-28T05:42:45+00:00Added an answer on May 28, 2026 at 5:42 am

    After lot of searching i got the answer as

    //origional image
     image = [UIImage imageNamed:@"images2.jpg"];
     imageView = [[UIImageView alloc] initWithImage:image];
    
     CGSize size = [image size];
    
     [imageView setFrame:CGRectMake(0, 0, size.width, size.height)];
     [[self view] addSubview:imageView];
     [imageView release];   
    
     //image to be brightnessed
     CGRect rect = CGRectMake([image size].width / 6, [image size].height / 6 , 
                             ([image size].width / 2), ([image size].height / 2));
    
     CGImageRef imageRef = CGImageCreateWithImageInRect([image CGImage], rect);
     UIImage *img = [UIImage imageWithCGImage:imageRef]; 
    
     imageView = [[UIImageView alloc] initWithImage:img];
     [imageView setFrame:CGRectMake([image size].width / 6, [image size].height / 6, ([image  size].width / 2), ([image size].height / 2))];
     [self.view addSubview:imageView];
     [imageView release];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Changing only y pos of background image via Jquery I want to
I have implemented the following set up (after being requested): slideshow of images changing,
I have implemented tracing based on System.Diagnostics. I am also using a System.Diagnostics.TextWriterTraceListener, and
We have implemented a popup window as a modal dialog using the IE method:
I am trying implement Unblock me Puzzle. i want to change image position from
I have a difficult dilemma. I implemented a java application using Netbeans while implementing
I have implemented an error style for textboxes using the following code. This sets
I have the simple class using auto-implemented properies: Public Class foo { public foo()
I have implemented what I thought was a pretty decent representation of MVC in
I have implemented a simple file upload-download mechanism. When a user clicks a file

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.