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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:33:00+00:00 2026-05-26T19:33:00+00:00

I fetch an image from the web and show it in an UIImage, but

  • 0

I fetch an image from the web and show it in an UIImage, but first i scaled it down. The thing is, if the image is black and white, the result is pretty bad, with lots of white lines crossing the pic.

I’ve tried many variations but i see no improvement, always the same poor quality result. Any tips?

Some of the things i tried (remember i’m working without an UIImageView):

http://iosdevelopertips.com/graphics/how-to-scale-an-image-using-an-objective-c-category.html

How to scale a UIImageView proportionally?

What's the easiest way to resize/optimize an image size with the iPhone SDK?

http://www.iphonedevsdk.com/forum/iphone-sdk-development/5204-resize-image-high-quality.html

  • 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-26T19:33:01+00:00Added an answer on May 26, 2026 at 7:33 pm

    Turns out @cbranch was right, so first here is the solution i found (without releases):

    - (BOOL) isGrayscaleImage:(UIImage *)image
    {
        CGImageRef imgRef = [image CGImage];
        CGColorSpaceModel clrMod = CGColorSpaceGetModel(CGImageGetColorSpace(imgRef));
    
        switch (clrMod) {
            case kCGColorSpaceModelMonochrome : 
                return YES;
            default:
                return NO;
        }
    }
    
    - (UIImage *) imageToGrayscale:(UIImage *)image
    {
        CGSize size = image.size; 
        CGRect rect = CGRectMake(0.0f, 0.0f, size.width, size.height); 
        CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray(); 
        CGContextRef context = CGBitmapContextCreate(nil, size.width, size.height, 8, 0, colorSpace, kCGImageAlphaNone); 
        CGColorSpaceRelease(colorSpace); 
        CGContextDrawImage(context, rect, [image CGImage]); 
        CGImageRef grayscale = CGBitmapContextCreateImage(context);
        UIImage *img = [UIImage imageWithCGImage:grayscale];
        return img;
    }
    

    Notice that this isn’t necessary for iOS5, don’t know why (nothing about this in the documentation).

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

Sidebar

Related Questions

When loading an image from the web I am getting a black screen. I
I know how to fetch image from photo library or camera in ios4.2.1 but
I used the code below to fetch the image from a url but it
My application often fetch data from a webpage using WebRequest, but it isn't possible
What is the simplest way to fetch an image from a url in an
I'm using PHP GD to fetch an image from a remote server. $res=imagecreatefromJPEG ($url);
Hail! I want to fetch image from NOT PUBLIC Google Site's page. I'm using
How to fetch image icons from an Array & append one by one inside
I'm trying to fetch an image from the AppEngine server in development mode, using
I am using an XMLHttpRequest to fetch an image from a server (run locally

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.