Image Processing
Image Processing
- Subject: Image Processing
- From: Lorenzo <email@hidden>
- Date: Sun, 06 Apr 2008 22:40:36 +0200
Still working with image-processing...
I have a source image 1680 x 1050 with (just a case) 240 dpi.
I load it with
sourceImage = [[NSImage alloc] initWithContentsOfFile:path]];
But when I ask for its size with
NSSize imageSize = [sourceImage size];
I donĀ¹t get the real pixel size (1680 x 1050), but I get (504 x 315) so when
I do some task (like mixing this image with another image), using a
temporary image
NSImage *tempImage = [[NSImage alloc] initWithSize:imageSize];
[tempImage lockFocus];
[sourceImage draw...
[watermarkImage draw...
[tempImage unlockFocus];
I end with a smaller tempImage (504 x 315) at 72 dpi. Too bad.
I even tried to get the real image pixels with
NSImageRep *imRep = [sourceImage bestRepresentationForDevice:nil];
NSSize imageSize = NSMakeSize([imRep pixelsWide],
[imRep pixelsHigh]);
Now imageSize is really 1680 x 1050 so I try to create the tempImage with
that imageSize, and mix the 2 images with
NSImage *tempImage = [[NSImage alloc] initWithSize:imageSize];
[tempImage lockFocus];
[sourceImage draw...
[watermarkImage draw...
[tempImage unlockFocus];
but it didn't help at all. In this case I get a destination image with the
same size as the original (1680 x 1050), but the original image is drawn
therein in a smaller area (504 x 315) in the letf-bottom corner.
So, please how should I work to always get a destination tempImage which has
the original imageSize at 72 dpi or the original imageSize at 240 dpi?
Best Regards
--
Lorenzo
email: email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden