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

  • Home
  • SEARCH
  • 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 6368827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:43:30+00:00 2026-05-25T00:43:30+00:00

I am using https://github.com/PaulSolt/UIImage-Conversion However, it seems to have a problem on the alpha

  • 0

I am using https://github.com/PaulSolt/UIImage-Conversion

However, it seems to have a problem on the alpha channel. Problem reconstituting UIImage from RGBA pixel byte data

I have simplified the problem so I present it as a tidier question.

I download Paul’s project, run it. It displays an image in the centre of the screen — everything so far is correct.

But his demo is not testing for Alpha.

So I attempt to composite my button image…

enter image description here

… on top.

The result is:

enter image description here

here is the code — I have just modified AppDelegate_iPad.m:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

    // Override point for customization after application launch.
    {
        UIImage *image = [UIImage imageNamed:@"Icon4.png"];
        int width = image.size.width;
        int height = image.size.height;

        // Create a bitmap
        unsigned char *bitmap = [ImageHelper convertUIImageToBitmapRGBA8:image];

        // Create a UIImage using the bitmap
        UIImage *imageCopy = [ImageHelper convertBitmapRGBA8ToUIImage:bitmap withWidth:width withHeight:height];

        // Cleanup
        if(bitmap) {
            free(bitmap);   
            bitmap = NULL;
        }

        // Display the image copy on the GUI
        UIImageView *imageView = [[UIImageView alloc] initWithImage:imageCopy];
        CGPoint center = CGPointMake([UIScreen mainScreen].bounds.size.width / 2.0, 
                                     [UIScreen mainScreen].bounds.size.height / 2.0);
        [imageView setCenter:center];
        [window addSubview:imageView];
        [imageView release];
    }


    if( 1 )
    {
        UIImage *image = [UIImage imageNamed:@"OuterButton_Dull.png"];
        int width = image.size.width;
        int height = image.size.height;

        // Create a bitmap
        unsigned char *bitmap = [ImageHelper convertUIImageToBitmapRGBA8:image];

        // Create a UIImage using the bitmap
        UIImage *imageCopy = [ImageHelper convertBitmapRGBA8ToUIImage:bitmap withWidth:width withHeight:height];

        // Cleanup
        if(bitmap) {
            free(bitmap);   
            bitmap = NULL;
        }

        // Display the image copy on the GUI
        UIImageView *imageView = [[UIImageView alloc] initWithImage:imageCopy]; // <-- X
        imageView.backgroundColor = [UIColor clearColor];
        CGPoint center = CGPointMake([UIScreen mainScreen].bounds.size.width / 2.0, 
                                     [UIScreen mainScreen].bounds.size.height / 2.0);
        [imageView setCenter:center];
        [window addSubview:imageView];
        [imageView release];

    }


    [window makeKeyAndVisible];

    return YES;
}

If I switch the line marked…

// <-- X 

to say…

... initWithImage:image]; // instead of imageCopy

… it displays as it should:

enter image description here

Is anyone up having a crack at this? It looks a really nice library to use, but I can’t figure out where the problem is.

  • 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-25T00:43:31+00:00Added an answer on May 25, 2026 at 12:43 am

    I just got a reply from the author:

    At the bottom of his blog post, http://paulsolt.com/2010/09/ios-converting-uiimage-to-rgba8-bitmaps-and-back/ Scott Davies presents a fix:

    There’s a simple one-line fix for your code so that alpha channels are
    preserved when you go from the byte buffer to the UIImage. In
    convertBitmapRGBA8ToUIImage, change this:

    CGBitmapInfo bitmapInfo = kCGBitmapByteOrderDefault;

    to this:

    CGBitmapInfo bitmapInfo = kCGBitmapByteOrderDefault |
    kCGImageAlphaPremultipliedLast;

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

Sidebar

Related Questions

I followed this tutorial: https://github.com/EllisLab/CodeIgniter/wiki/PDF-generation-using-dompdf However, I can't seem to set the path right.
I downloaded the JSON2.js from https://github.com/douglascrockford/JSON-js/blob/master/json2.js and it does not have implementation for JSON2.stringify()
I am using the encryptor gem from https://github.com/shuber/encryptor and need to be able to
I'm using https://github.com/akzhan/jwysiwyg/ and i want to implement pasting from Word, but I'm not
I want to use the zsh-git-prompt, from this repo https://github.com/olivierverdier/zsh-git-prompt , I've been using
I'm using Cufon ( https://github.com/sorccu/cufon/wiki/about ) to use special fonts in my website. But
I'm using facebox ( https://github.com/defunkt/facebox ) for calling web pages in modal window. Is
I'm using clearance ( https://github.com/thoughtbot/clearance/wiki ) for authentication in my rails app. But I'm
I am using this plugin: https://github.com/augustl/live-validations/wiki to check if the form field entered is
Seems like both EnyimMemcached ( https://github.com/enyim/EnyimMemcached ) and BeITMemcached ( http://code.google.com/p/beitmemcached/ ) are popular

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.