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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:51:50+00:00 2026-05-27T19:51:50+00:00

I don’t understand really well the premultiplied alpha. I need a NSBitmapImageRep without alpha

  • 0

I don’t understand really well the premultiplied alpha.

I need a NSBitmapImageRep without alpha channel (I don’t need a particular bpp).

My problem is that this code give me errors:

NSSize imageSize = NSMakeSize(200, 200);

//create a non-alpha RGB image rep with the same dimensions as the image
  NSBitmapImageRep* bitmap = [[NSBitmapImageRep alloc]
                         initWithBitmapDataPlanes:NULL
                         pixelsWide:imageSize.width
                         pixelsHigh:imageSize.height
                         bitsPerSample:8
                         samplesPerPixel:3
                         hasAlpha:NO
                         isPlanar:NO
                         bitmapFormat:NSAlphaNonpremultipliedBitmapFormat
                         bytesPerRow:(3 * imageSize.width)
                         bitsPerPixel:24];

//lock focus on the bitmap

   NSGraphicsContext *context = [NSGraphicsContext graphicsContextWithBitmapImageRep:bitmap];
   [NSGraphicsContext saveGraphicsState];
   [NSGraphicsContext setCurrentContext:context];

//draw the image into the bitmap

[prueba drawAtPoint:NSMakePoint(0, 0) withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[NSFont systemFontOfSize:24], NSFontAttributeName, nil]];

[NSGraphicsContext restoreGraphicsState];

//get the TIFF data
   NSData* tiffData = [bitmap TIFFRepresentation];

//do something with TIFF data
   NSError *error = nil;
   [tiffData writeToFile:@"/Users/Paul/test.tif" options:NSDataWritingAtomic error:&error];

Error: CGBitmapContextCreate: unsupported parameter combination: 8 integer bits/component; 24 bits/pixel; 3-component color space; kCGImageAlphaNone; 640 bytes/row.

Okay, I know this combination it’s not supported but I need something like this and I don’t find a solution.

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

    Nope. The formats that Quartz supports are listed here, and like the error message you got said, 24-bit without alpha is not one of them. Since AppKit’s drawing APIs are built on top of Quartz, that list applies to AppKit, too.

    The best you can do is fill your context with a solid color, such as [NSColor blackColor], before you draw whatever you want to draw. You’ll still have an alpha channel in the context, but no actual transparency.

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

Sidebar

Related Questions

Don't think that I'm mad, I understand how php works! That being said. I
Don't let below code scare you away . The question is really simple, only
Don't be scared of the extensive code. The problem is general. I just provided
Don't really know how to formulate the title, but it should be pretty obvious
I don't edit CSS very often, and almost every time I need to go
I don't understand where the extra bits are coming from in this article about
Don't know if this is an eclipse specific problem but whenever I declare a
Don't worry, I'm not going to ask that question, yet again... I am wanting
DON'T ASK WHY but... I have a regex that needs to be case insensitive
don't understand: in my controller: @json = User.all.to_gmaps4rails do |user| \Title\: \#{user.email}\ end in

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.