Re: I want ALL my tiff pixels
Re: I want ALL my tiff pixels
- Subject: Re: I want ALL my tiff pixels
- From: Marco Binder <email@hidden>
- Date: Wed, 12 Mar 2003 17:22:14 +0100
#import "StopBitchingAboutEverythingAndStartThinking.h"
If you need an NSImage, try initializing it by referencing instead.
Recaching might also help. But actually, I really recommend using an
NSBitmapImageRep directly instead of NSImage. Since you dont even have
an NSImageView but draw the thing directly into your view, you can just
use an imagerep instead. Looking at the pixelsWide or pixelsHigh gives
you the real amount of pixels, while size.width and size.height tell
you the printing dimesnions. -> size.width/pixelsWide gives you the
correct resolution.
Viola! (oops, I hope no American mistakes me for a French. I m NOT! I m
a German! LOL )
marco
Am Mittwoch, 12.03.03 um 16:40 Uhr schrieb robert l clair:
#import "ExtendBitchingAboutUselesslySparseDocumentation.h"
I want *ALL* my pixels. I have (let's say) a 1200 pixel
square tiff created in Photoshop with a "resolution"
of 600 dpi. I read it into an NSImage using something like
NSImage* myImage = [[NSImage alloc] initWithContentsOfFile:
@"myfile.tiff"];
I then draw it in a view with:
NSRect myRect = NSZeroRect;
NSPoint myPoint = NSZeroPoint;
myRect.size = [myImage size];
[myImage drawAtPoint: myPoint fromRect: myRect
operation: NSCompositeSourceAtop fraction: 1.0];
The result is an ugly 144 "pixels" square [really ugly
since my view bounds are scaled to give the real 101.4 dpi
of a powerbook, ie 72 points comes out an honest-measurable-
with-a-dimestore-ruler inch on the screen]. If I print it -
it prints 2 inches square with big blocky "pixels". If I
scaleup the view the ugliness scales.
A little investigation with the debugger reveals: The image has
a size of of 144 x 144. It has one representation with
a size of 144 x 144. pixelsHigh, pixelWide on the image rep admit
to being 1200.
What I want: I want all my 1200 x1200 pixels, and to know that the
resolution field says it's 600 dpi so that I can scale it
myself to what ever magnification I want and so that it will print
nicely.
All this works just fine with a GIF (well, you don't know the
resolution,
so it is huge until you scale it down) but I have to be able
to read tiffs.
I'm not interested in NSImageView or NSImageCell - this is a general
graphics window and there is a lot of other stuff drawn there.
Any help with the correct incantation or pointers to better
documentation would be appreciated. Despite years of training
as a physicist, I'm getting a bit tired of the experimental
method.
......Thanks
Bob Clair
Extra Bonus Gripe: Why does everything (including the useless sample
code for this on the Apple site) report that screen resolution
is 72 ? I know that it fits conveniently with 72 points
per inch and that a generic VGA monitor can't tell you, but 100
dpi is more like it these days.
-------------------------------------------------------------
The Confusion is the gradient of the Potential for Confusion.
_______________________________________________
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.
--
|\ /| 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.