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
1
vote
1 answer

Getting into pixel data of NSImage

I'm writing application that operates on black&white images. I'm doing it by passing a NSImage object into my method and then making NSBitmapImageRep from NSImage. All works but quite slow. Here's my code: - (NSImage *)skeletonization: (NSImage…
metal_man
  • 580
  • 1
  • 9
  • 22
1
vote
1 answer

Change color during the drawing on a NSBitmapImageRep

I implemented a methode that returns a NSBitmapImageRep. Onto that bitmap 10x2 rectangles should be drawn and each rectangle should be filled with the color cyan. But for each rectangle the cyan value should be increased by 12 (value starts at…
1
vote
1 answer

Is there a faster way to compare NSBitmapImageRep objects pixel by pixel?

I'm trying to speed up some code that i wrote a while back. Using instruments in Xcode I've found that the major bottleneck is in this method, in particular the getPixel call. - (BOOL)fasterCompareImage:(NSBitmapImageRep *)imageRepA…
1
vote
0 answers

Color shifting when drawing image with same color background

What I expected was that the output would be this http://i45.tinypic.com/344ehb5.png image on a 1440x900 background with the same background color of image (not the red), this happens but there is a tiny shift on the color which makes that the…
Max
  • 259
  • 2
  • 11
1
vote
1 answer

Extract every page of a PDF as images : set the size of the image

I've had some problem setting the size of the output image in the code below (which I found as an answer to another StackOverflow question). I need to output the images as small previews and High Res images. But no matter what, it only outputs in…
Jer-o-nimo
  • 13
  • 3
1
vote
1 answer

Sub-pixel anti-aliasing in NSBitmapImageRep

Is there a way to draw text in an NSBitMapImageRep with sub-pixel anti-aliasing? The text is drawn on an opaque white background and I've tried using the CGContextSetShouldSmoothFonts function, but that doesn't seem to help. NSBitmapImageRep *bm =…
Steven Vandeweghe
  • 2,170
  • 2
  • 20
  • 24
0
votes
1 answer

cocoa: How can I draw a scaled up version of NSBitmapImageRep?

I want to use NSBitmapImageRep to construct a 64x64 pixel sprite in code, and then draw it to the screen, blown up very large. The result would be very large "pixels" on the screen. Think old school Mario Bros. or Minecraft. How can I do this? Edit…
mtmurdock
  • 12,756
  • 21
  • 65
  • 108
0
votes
1 answer

How "bytesPerRow" is calculated from an NSBitmapImageRep

I would like to understand how "bytesPerRow" is calculated when building up an NSBitmapImageRep (in my case from mapping an array of floats to a grayscale bitmap). Clarifying this detail will help me to understand how memory is being mapped from an…
Bruce Dean
  • 2,798
  • 2
  • 18
  • 30
0
votes
1 answer

Creating an OpenGL texture with alpha using NSBitmapImageRep

I am loading a PNG using: theImage = [NSBitmapImageRep imageRepWithContentsOfFile:imagePath]; from which I can successfully create a gl texture and render correctly without any transparency. However, when I switch blending on…
Seamus
  • 1,107
  • 10
  • 22
0
votes
1 answer

Swift - OSX - resize NSImage data

I am trying to resize a NSImage to use it with parse as a PFFile and I need to change its dimension to reduce its data size it but it is not working. The resized image resizes the width and height inside Swift but it keeps the same dimensions from…
GuiDupas
  • 1,681
  • 2
  • 22
  • 44
0
votes
1 answer

When creating a CGImage with a decode array, the output has all of it's pixels offset by a small amount

Very weird behavior, but I have narrowed the problem down as far as I can go I think I have a NSImage, let's call it inputImage. It is represented by a NSBitmapImageRep in a CGColorSpaceCreateDeviceGray, if that matters I want to create a…
A O
  • 5,516
  • 3
  • 33
  • 68
0
votes
1 answer

NSBitmapImageRep load image

i'm quite new to objective C and followed some instructions i found, but at the moment i got stuck. i am trying to load an image with the following code: NSBitmapImageRep *img; img = [NSBitmapImageRep…
Rolf
  • 85
  • 1
  • 6
0
votes
1 answer

NSBitmapImageRep -initWithFocusedViewRect is doubling size of image

I have the following objective-C function meant to resize an NSBitmapImageRep to a designated size. Currently, when working with an image of size 2048x1536 and trying to resize it to 300x225, this function keeps returning an NSBitmapImageRep of size…
mosquito242
  • 353
  • 5
  • 17
0
votes
0 answers

Ways to speed up calculations in Objective-C?

I'm writing a simple program that finds the brightest pixel in an image which in the future with be implemented it something that finds the brightest pixel of a video frame. With small images it works fine. On my 8x8 test image thats all black with…
0
votes
0 answers

CGImage to NSData is too slow

I am creating an application in which many screenshots are taken, converted to NSData, and saved. With the current code I have, everything works with no errors, but running bitmap.representationUsingType(NSBitmapImageFileType.NSJPEGFileType,…
B Person
  • 33
  • 6