Image Preview

  • Hi,
    I scan a folder containing a lot of image files and I show a list of preview
    of each image file contents. I read each image file with
        [[NSImage alloc] initWithContentsOfFile:filePath];
    Of course if the folder contains a lot of image files and/or the image files
    are huge (GBs), this task takes a lot of time. So I ask, is a way to get
    quickly a preview of the image file (if any already embedded into the image
    file)? I link to SDK 10.4, not yet Leopard.

    Best Regards
    --
    Lorenzo
    email: <archidea...>
  • On Nov 14, 2007, at 12:33 PM, Lorenzo wrote:

    > Hi,
    > I scan a folder containing a lot of image files and I show a list
    > of preview
    > of each image file contents. I read each image file with
    > [[NSImage alloc] initWithContentsOfFile:filePath];
    > Of course if the folder contains a lot of image files and/or the
    > image files
    > are huge (GBs), this task takes a lot of time. So I ask, is a way
    > to get
    > quickly a preview of the image file (if any already embedded into
    > the image
    > file)? I link to SDK 10.4, not yet Leopard.

    You want to use the functions in CGImageSource.h.  Specifically,
    create a CGImageSource from an image file and then create a thumbnail
    from that image source.  For most image types, this is much more
    efficient than decoding the entire file and scaling it down.

    -Peter
previous month november 2007 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today