"Inconsistent set of values to create NSBitmapImageRep" Help!

Nibbie
Posts: 1
Joined: 2010.11
Post: #1
*grumbles about lack of experience in Cocoa*

I am simply trying to create an NSBitmapImageRep with a width of (int)widthPxl and a height of (int)heightPxl and a type of NSJPEGFileType. Here's my code:

Code:
NSBitmapImageRep *tempBitmapImageRep;
tempBitmapImageRep=[[NSBitmapImageRep alloc]
            initWithBitmapDataPlanes:NULL
            pixelsWide:widthPxl
            pixelsHigh:heightPxl
            bitsPerSample:8
            samplesPerPixel:3
            hasAlpha:NO
            isPlanar:YES
            colorSpaceName:NSDeviceRGBColorSpace
            bitmapFormat:NSJPEGFileType
            bytesPerRow:0
            bitsPerPixel:0];

This is giving me "Inconsistent set of values to create NSBitmapImageRep" and I have checked widthPxl and heightPxl. What am I doing wrong? Is there an easier way to create an NSBitmapImageRep with those three parameters? (width, height, jpg)
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
a) NSJPEGFileType is not a valid argument for bitmapFormat:, read the docs.
b) even if it was, I doubt that you'd be allowed to have a planar image with it, nor that you'd actually want one.

what are you really trying to achieve?
Quote this message in a reply
Nibbie
Posts: 1
Joined: 2010.11
Post: #3
I'm trying to capture an NSView and save it as a JPEG image at a specific size and resolution. One step in this is creating an NSBitmapImageRep of this size.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  passing values from vertex to fragment shader Sumaleth 6 11,404 Feb 18, 2011 01:54 AM
Last Post: Holmes
  Changing Pixel Values using CG LIPH700 1 4,676 Nov 25, 2010 03:17 PM
Last Post: SethWillits
  Strange OpenGl or NSBitmapImageRep error magnusrw 4 3,401 Apr 24, 2009 11:13 AM
Last Post: magnusrw
  NSBitmapImageRep/CIImage questions Caveman 6 6,378 Sep 6, 2008 04:37 PM
Last Post: ThemsAllTook
  Copying between NSBitmapImageRep objects Emehr 3 4,238 Oct 31, 2007 01:27 PM
Last Post: Emehr