• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: changing brightness and contrast in an nsimage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: changing brightness and contrast in an nsimage


  • Subject: Re: changing brightness and contrast in an nsimage
  • From: Kenny Leung <email@hidden>
  • Date: Sat, 3 Dec 2005 22:02:56 -0800

I've been wondering why this is so difficult, and I think that the answer is that all of this stuff is meant to be done in the display pipeline. If you want the bits back, you can probably use -[CIContext createCGImage:fromRect:]. If you are in the NSImage world, you can render into an NSImage and pull back the bits by creating an NSBitmapImageRep from the NSImage data:

image = [[NSImage alloc] initWithSize:NSMakeSize(width, height)];
[image lockFocus];
[[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh];
[[self adjustedImage] drawInRect:NSMakeRect(0, 0, width, height) fromRect:NSMakeRect(0, 0, [self image_width], [self image_height]) operation:NSCompositeCopy fraction:1.0];
imageRep = [[NSBitmapImageRep alloc] initWithFocusedViewRect:NSMakeRect(0, 0, width, height)];
[image unlockFocus];
data = [imageRep representationUsingType:NSJPEG2000FileType properties:nil];

-Kenny


On Dec 3, 2005, at 9:39 PM, Eric Smith wrote:

OK... I've gone to the CIImage.

Next question: I can create a CIImage from NSBitmapImagRep, but all I can get from the CIImage is an NSImageRep... this has no method for getting at the bitmap data. Once I'm using a CIImage, how do I get the bitmap data?

Thanks again,
Eric

On Dec 3, 2005, at 7:30 PM, Dave Camp wrote:

I think the problem is it isn't clear what you are asking for...

Are you asking for pointers to general brightness and contrast algorithms?
Are you asking how to get at the NSImage bitmap data to manipulate it yourself?
Or are you asking if there are other Apple supplied frameworks that will perform brightness and contrast adjustments for you?

Dave

On Dec 3, 2005, at 8:04 PM, Eric Smith wrote:

CIImage wasn't even around until 10.4... there must be a way to handle this from an NSImage. Anyone out there use brightness and contrast controls on an NSImage, or the bitmap data associated with the NSImage?

Thanks,
Eric

On Dec 2, 2005, at 9:34 PM, John C. Randolph wrote:


On Dec 2, 2005, at 9:29 PM, Eric Smith wrote:

I've been going around in circles with this one...

What is a good way to change the brightness and contrast in an NSImage?

I've been playing with the vImage library for changing contrast, using the vImageEndsInContrastStretch. This works, but how does one return the contrast to it's original value? Once you specify that > 0% of the pixels lie at the histogram extreme, you can't get the original values back. I know of the ImagApp example showing how to use CIImage, but using that would require a re-write of quite a bit of code... I'd rather not go there.

Too bad, because that's how to do it.

-jcr



John C. Randolph <email@hidden> (408) 914-0013
Roaming Cocoa Engineer,
Available for your projects at great Expense and Inconvenience.




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40criticalpath.com

This email sent to email@hidden



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40pobox.com

This email sent to email@hidden


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Follow-Ups:
    • Re: changing brightness and contrast in an nsimage
      • From: "John C. Randolph" <email@hidden>
References: 
 >changing brightness and contrast in an nsimage (From: Eric Smith <email@hidden>)
 >Re: changing brightness and contrast in an nsimage (From: "John C. Randolph" <email@hidden>)
 >Re: changing brightness and contrast in an nsimage (From: Eric Smith <email@hidden>)
 >Re: changing brightness and contrast in an nsimage (From: Dave Camp <email@hidden>)
 >Re: changing brightness and contrast in an nsimage (From: Eric Smith <email@hidden>)

  • Prev by Date: Re: changing brightness and contrast in an nsimage
  • Next by Date: Re: changing brightness and contrast in an nsimage
  • Previous by thread: Re: changing brightness and contrast in an nsimage
  • Next by thread: Re: changing brightness and contrast in an nsimage
  • Index(es):
    • Date
    • Thread