Skip navigation.
 
mlRe: NSImage or CIImage? Resolution problem
FROM : Stephane Sudre
DATE : Tue Aug 01 19:21:13 2006

On 1 août 06, at 19:08, Bill So wrote:

> Dear All,
>
> I am a bit new to graphics programming.  I am trying to display an
> image in a customer NSView.
>
> The custom NSView is very simple.  It just displays an image in the
> drawRect: method like below:
>     sampleImage = [NSImage imageNamed:@"myimage.jpg"];
>     [sampleImage compositeToPoint:NSMakePoint(0.0, 0.0)
> operation:NSCompositeSourceOver];
>
> sampleImage is an NSImage object.
>
> sampleImage is from a JPG file which was obtained from my DC.  (And I
> scaled it down to 800 x 600)
>
> Below is the info. of the image in "Preview" app.
>
>     File Name    myimage.jpg
>     Document Type    JPEG Image
>     File Size    218439 bytes
>     Color Model    RGB
>     Depth    8
>     DPI Height    300
>     DPI Width    300
>     Orientation    1
>     Pixel Height    600
>     Pixel Width    800
>     Profile Name    Camera RGB Profile
>
> When I call [sampleImage size], the returned size is not 800 x 600.
> It is 192 x 144.  How do I get NSImage use the exact pixel size? (i.e.
> 800 x 600)
>
> http://developer.apple.com/documentation/Cocoa/Conceptual/
> CocoaDrawingGuide/Images/chapter_7_section_2.html#//apple_ref/doc/uid/
> TP40003290-CH208-SW2
>
> Read the doc above but it just gives too little info for what I need 
> to know...
>
> Please kindly advise.


NSImageRep * thisIsAImageRep=[[myImageWhichIsNoySeventyTwoDPI 
representations] objectAtIndex:0];

[thisIsAImageRep pixelsHigh];

[thisIsAImageRep pixelsWide];

Related mailsAuthorDate
mlNSImage or CIImage? Resolution problem Bill So Aug 1, 19:08
mlRe: NSImage or CIImage? Resolution problem Stephane Sudre Aug 1, 19:21
mlRe: Re: NSImage or CIImage? Resolution problem Bill So Aug 3, 04:32