• 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: per pixel reading from a tiff
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: per pixel reading from a tiff


  • Subject: Re: per pixel reading from a tiff
  • From: Marco Binder <email@hidden>
  • Date: Fri, 20 Sep 2002 23:57:27 +0200

*This message was transferred with a trial version of CommuniGate(tm) Pro*
I've been looking thru the cocoa dev mailing list archive for a explanation as how to get the RGB value of a single pixel from a tiff file and the best i could find was this: http://cocoa.mamasam.com/MACOSXDEV/2002/01/2/22626.php This seems like a fairly major thing to be simply 'left out' or is there an easy way to do this that I am missing?

Well, there are two way of doing this:

1) as mentioned in the posting you quoted, you can use the (NSColor*)NSReadPixel:(NSPoint)point on a focus-locked NSView (e.g. NSImageView). You can then read the color components with - (void)getRed:(float *)red green:(float *)green blue:(float *)blue alpha:(float *)alpha. That might me enough for your purpose.

2) you can initiate an NSBitmapImageRep with your TIFF-data and then get the REAL pixel-data in an byte-buffer by calling (unsigned char*)bitmapData on the NSBitmapImageRep. This is lower level and lets you even read correct values for images using >8bit per pixel. But therefore, you have to do quite some conversions:

- The origin of an image is upper left, remember!

- You have to take in account samples per pixel, bits per sample and all that stuff to actually get to the byte(s) holding your pixel value (read the documentation for NSImageRep and NSBitmapImageRep).

Hope that helps, if you need to know anything more bout the second way, lemme know.

marco


--
|\ /| E-Mail: email@hidden WWW: www.marco-binder.de
| \/ | Telefon: 07531 / 94 19 94 Fax: 07531 / 94 19 92
| |ARCO Snail-Mail: Banater Str. 3 - 78467 Konstanz
BINDER _____________________________________________________
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: per pixel reading from a tiff
  • Next by Date: sockets in threaded obj-C app.
  • Previous by thread: Re: per pixel reading from a tiff
  • Next by thread: Show/Hide a PSN?
  • Index(es):
    • Date
    • Thread