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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:24:35+00:00 2026-05-19T01:24:35+00:00

I would like to know if anyone can point me in the right direction

  • 0

I would like to know if anyone can point me in the right direction regarding what frameworks/methods
to use when replacing a block of pixels in an image with another block of pixels.

For example lets say I have a simple image colored fully red and I consider my pixel block size as 5×5
pixels. Now every 3 blocks I want to replace the 3rd block with a blue colored block (5×5 pixels) so
that it would result in a red image with blue blocks appearing every 3 red blocks.

I’ve found information regarding pixel replacement but am trying to figure out how to determine and process pixel blocks. Any advice would be appreciated.. and any code would be a wet dream.

  • 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-19T01:24:36+00:00Added an answer on May 19, 2026 at 1:24 am

    Although it may sound like a simple question, it’s not quite easy to do something like that. You need a lot of background information to get everything going. It also depends on where the image comes from, and what you want to do with it.

    I will not provide you with a working example, but here’s some pointers:

    Reading in an image:

    UIImage *img = [UIImage imageNamed:@"myimage.png"];
    // make sure you added myimage.png to your project
    

    Creating your own “graphics context” to draw on:

    UIGraphicsBeginImageContext(CGSizeMake(480.0f, 320.0f)); // the size (width,height)
    CGContextRef ctx = UIGraphicsGetCurrentContext();
    

    Painting your image onto your (current) context:

    [img drawAtPoint:CGPointMake(0.0f, -480.0f)]; // (draws on current context)
    

    Doing some other painting:

    CGContextBeginPath(ctx); // start a path
    CGContextSetRGBStrokeColor(ctx,1,0,0,1); // red,green,blue,alpha with range 0-1
    CGContextMoveToPoint(ctx,50,0); // move to beginning of path at point (50,0)
    CGContextAddLineToPoint(ctx,100,100); // add a line to point (100,100)
    CGContextStrokePath(ctx); // do the drawing
    

    Transforming the bitmap context to an image again:

    UIImage *resultImage = UIGraphicsGetImageFromCurrentImageContext();
    

    And then, either:

    Show the image to the audience, from within a view controller:

    [self.view addSubview:[[[UIImageView alloc] initWithImage:resultImage] autorelease]];
    

    Or write the image as jpeg:

    NSData *imagedata = UIImageJPEGRepresentation(img,0.8); // 0.8 = quality
    [imagedata writeToFile:filename atomically:NO];
    

    Or as PNG:

    NSData *imagedata = UIImagePNGRepresentation(img);
    [imagedata writeToFile:filename atomically:NO];
    

    For those last ones you would need to have a filename, which is not so trivial either (given the phone environment you live in). That’s another topic on which you’ll find a lot, search for things like:

    NSArray *path = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
    NSString *filename = [[path elementAtIndex:0] stringByAppendingPathComponent:@"myimage.png"];
    

    This is the general outline, I might have made some errors but this should get you going at least.

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

Sidebar

Related Questions

I want to know if anyone can point me in the right direction for
Please can anyone point me in the right direction for compressing a (quite long)
Hi I wonder if anyone can point me in the right direction with this
I would like to know if anyone sees a pattern in the sequence given
I would like to know how Gmail (or anyone else) does comet on Opera.
Does anyone know of an equivalent to FxCop/StyleCop for Delphi? I would really like
i would like know some reference. I know i can googling it. but prefer
I would like to know what code to use to convert a double[] array
Could anyone point me in the right direction when it comes to handling Word
I am hoping someone can point me in the right direction. I have 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.