Questions tagged [nsbitmapimagerep]

The NSBitmapImageRep class renders an image from bitmap data. Bitmap data formats supported include GIF, JPEG, TIFF, PNG, and various permutations of raw bitmap data.

The NSBitmapImageRep class renders an image from bitmap data. If a coverage (alpha) plane exists, a bitmap’s color components are premultiplied with it. If you modify the contents of the bitmap, you are therefore responsible for premultiplying the data. For this reason, though, if you want to manipulate the actual data, an NSBitmapImageRep object is not recommended for storage. If you need to work with data that is not premultiplied, you should use Quartz, specifically CGImageCreate with kCGImageAlphaLast.

More : NSBitmapImageRep Class Reference

56 questions
2
votes
0 answers

NSTextView -> cacheDisplay loses some underlines but not others

In my app I am having an odd issue with underlines. I don’t have the issue with any other font related properties (size, style, bold, etc,), only with underlines. I have text data in an NSTextView, theView. The underlines are correct everywhere in…
Howard Shere
  • 143
  • 1
  • 7
2
votes
1 answer

Save NSImageView to disk as png/jpg

I'm trying to create an image from the contents of (all subviews) an NSImageView and save it to disk on a Mac. Right now the step of writing it to disk is failing. As I step through the code in the debugger, I notice that imageData doesn't appear to…
Kevin_TA
  • 4,575
  • 13
  • 48
  • 77
2
votes
1 answer

What can I use instead of NSBitmapImageRep in iOS? (Water ripples example)

I found this interesting post about water ripple simulation. It includes a Xcode project with a little cocoa app for OSX. I tried to get the app running in iOS using Swift, but I couldn't find a solution to the following problem: The OSX app uses…
ediheld
  • 233
  • 3
  • 13
2
votes
2 answers

How to create a CGImageRef from a NSBitmapImageRep?

How can I create a CGImageRef from a NSBitmapImageRep? Or how can I define a complete new CGImageRef in the same way as the NSBitmapImageRep? The definition of a NSBitmapImageRep works fine. But I need an image as CGImageRef. unsigned char *plane =…
3ef9g
  • 781
  • 2
  • 9
  • 19
2
votes
1 answer

Saving NSBitmapImageRep as NSBMPFileType file. Wrong BMP headers and bitmap content

I save a NSBitmapImageRep to a BMP file (Snow Leopard). It seems ok when i open it on macos. But it makes an error on my multimedia device (which can show any BMP file from internet). I cannot figure out what is wrong, but when i look inside the…
niko34
  • 21
  • 3
2
votes
2 answers

Create RGB image from each channel

I have 3 files, one with only a red channel, one with only a green channel, one with only a blue channel. Now i want to combine those 3 images to one, where every image is one color-channel in the finished image. How can i do this with cocoa? I have…
thomasguenzel
  • 670
  • 7
  • 25
2
votes
1 answer

Scale Up NSImage and Save

I would like to scale up an image that's 64px to make it 512px (Even if it's blurry or pixelized) I'm using this to get the image from my NSImageView and save it: NSData *customimageData = [[customIcon image] TIFFRepresentation]; …
atomikpanda
  • 1,845
  • 5
  • 33
  • 47
2
votes
3 answers

NSImage + NSBitmapImageRep = Converting RAW image file from one format to another

I am trying to write a prototype to prove that RAW conversion from one format to another is possible. I have to convert a Nikon's raw file which is of .NEF format to Canon's .CR2 format. With help of various posts I create the original image TIFF…
Raj Pawan Gumdal
  • 7,390
  • 10
  • 60
  • 92
2
votes
1 answer

Convert NSImage from CMYK to RGB

After a full day of searching, I've found a few similar answers, but nothing that seems to work for me. I've built an app to be used in OSX which fetches a list of images from a user inputted directory, runs each through a renaming process, converts…
joeByDesign
  • 133
  • 8
1
vote
1 answer

NSBitmapImageRep generated BMP can't be read on Windows

I have an NSBitmapImageRep that I am creating the following way: + (NSBitmapImageRep *)bitmapRepOfImage:(NSURL *)imageURL { CIImage *anImage = [CIImage imageWithContentsOfURL:imageURL]; CGRect outputExtent = [anImage extent]; …
EduAlm
  • 813
  • 3
  • 11
  • 27
1
vote
1 answer

Apply a Gamma of 1.8 to an NSImage

I'm trying to convert an NSImage to have a a gamma of 1.8 and I'm not having much luck. I've found some code but nothing that's working. I've got a method that returns an NSBitmapImageRep on an NSImage category. First I tried changing the color…
keegan3d
  • 10,357
  • 9
  • 53
  • 77
1
vote
1 answer

Converting an NSBitmapImageRep to NSImage

I'm flipping between NSImage and NSBitmapImageRep(because only NSBitmapImageRep lets me find-replace colors per-pixel, but only NSImages can be used in a NSImageView/NSImageCell's setImage). I know how to convert a NSImage to a NSBitmapImageRep…
1
vote
1 answer

How to keep NSBitmapImageRep from creating lots of intermediate CGImages?

I have a generative art application which starts with a small set of points, grows them outwards, and checks the growth to make sure it doesn't intersect with anything. My first naive implementation was to do it all on the main UI thread with the…
user1118321
  • 25,567
  • 4
  • 55
  • 86
1
vote
1 answer

Lossless compression of PNG in memory as NSData?

I currently have an NSData with valid PNG data: NSData* imageData = [bitmapRep representationUsingType:NSPNGFileType properties:nil]; I've written this data out to a file: [imageData writeToFile:@"test.png" atomically:YES]; And compressing it with…
Jonathan
  • 11
  • 1
1
vote
1 answer

NSView cacheDisplayInRect:toBitmapImageRep: Memory Leak

In my project (Cocoa) I need to compare the visual similarity of two NSView. Here's the function for the comparison: - (void)compareWithHandler: (void (^)(CGFloat fitness)) handler { @autoreleasepool { __block CGFloat fitness = 0; …
hklel
  • 1,624
  • 23
  • 45