• 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
Image Processing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Image Processing
      • From: Kenny Leung <email@hidden>
    • Re: Image Processing
      • From: Jens Alfke <email@hidden>
References: 
 >Re: NSShadow on a raster image (From: Jean-Daniel Dupas <email@hidden>)

  • Prev by Date: Re: Scaling a window background image quickly
  • Next by Date: Re: Menu Key Equivalents Not Displayed
  • Previous by thread: Re: NSShadow on a raster image
  • Next by thread: Re: Image Processing
  • Index(es):
    • Date
    • Thread