Which framework to use CGImage?

  • What framework has to be linked/imported to use CGImages? I tried
    <Quartz/Quartz.h> but when I try to load an image using:

    CGImageSourceRef source =
    CGImageSourceCreateWithURL( (CFURLRef)imgUrl, NULL);

    I get the following error:
    <Error>: CGImageSourceCreateWithURL failed with error code -15.

    I am already importing <QuartzCore/QuartzCore.h> because I'm using
    CIImag, however, now I need to use CGImage and for some reason I can't
    get it to work...

    Jean-Nicolas Jolivet
    <silvertab...>
    http://www.silverscripting.com
  • Well, apparently it's not a framework problem since I can use:

    CGImageSourceRef source =
    CGImageSourceCreateWithData((CFDataRef)tempData, NULL);

    without a problem...

    Any other reasons why CGImageSourceCreateWithURL would yield an error
    code -15???

    On 18-Nov-08, at 3:18 AM, Jean-Nicolas Jolivet wrote:

    > What framework has to be linked/imported to use CGImages? I tried
    > <Quartz/Quartz.h> but when I try to load an image using:
    >
    > CGImageSourceRef source =
    > CGImageSourceCreateWithURL( (CFURLRef)imgUrl, NULL);
    >
    > I get the following error:
    > <Error>: CGImageSourceCreateWithURL failed with error code -15.
    >
    >
    > I am already importing <QuartzCore/QuartzCore.h> because I'm using
    > CIImag, however, now I need to use CGImage and for some reason I
    > can't get it to work...
    >
    >
    > Jean-Nicolas Jolivet
    > <silvertab...>
    > http://www.silverscripting.com

    Jean-Nicolas Jolivet
    <silvertab...>
    http://www.silverscripting.com
  • one possible .. |kCFURLImproperArgumentsError is defined as -15. Is the
    imgUrl ok? Can you send a Null dictionary to that function or should you
    send an empty one? |

    Jean-Nicolas Jolivet wrote:

    > Well, apparently it's not a framework problem since I can use:
    >
    > CGImageSourceRef source =
    > CGImageSourceCreateWithData((CFDataRef)tempData, NULL);
    >
    > without a problem...
    >
    > Any other reasons why CGImageSourceCreateWithURL would yield an error
    > code -15???
    >
    >
    > On 18-Nov-08, at 3:18 AM, Jean-Nicolas Jolivet wrote:
    >
    >> What framework has to be linked/imported to use CGImages? I tried
    >> <Quartz/Quartz.h> but when I try to load an image using:
    >>
    >> CGImageSourceRef source =  CGImageSourceCreateWithURL(
    >> (CFURLRef)imgUrl, NULL);
    >>
    >> I get the following error:
    >> <Error>: CGImageSourceCreateWithURL failed with error code -15.
    >>
    >>
    >> I am already importing <QuartzCore/QuartzCore.h> because I'm using
    >> CIImag, however, now I need to use CGImage and for some reason I
    >> can't get it to work...
    >>
    >>
    >> Jean-Nicolas Jolivet
    >> <silvertab...>
    >> http://www.silverscripting.com
    >
    >
    > Jean-Nicolas Jolivet
    > <silvertab...>
    > http://www.silverscripting.com
  • Wait you might be onto something...

    I was using [NSURL URLWithString]
    instead of [NSURL fileURLWithPath]

    On 18-Nov-08, at 3:35 AM, Roland King wrote:

    > one possible .. |kCFURLImproperArgumentsError is defined as -15. Is
    > the imgUrl ok? Can you send a Null dictionary to that function or
    > should you send an empty one? |
    >
    > Jean-Nicolas Jolivet wrote:
    >
    >> Well, apparently it's not a framework problem since I can use:
    >>
    >> CGImageSourceRef source =
    >> CGImageSourceCreateWithData((CFDataRef)tempData, NULL);
    >>
    >> without a problem...
    >>
    >> Any other reasons why CGImageSourceCreateWithURL would yield an
    >> error  code -15???
    >>
    >>
    >> On 18-Nov-08, at 3:18 AM, Jean-Nicolas Jolivet wrote:
    >>
    >>> What framework has to be linked/imported to use CGImages? I tried
    >>> <Quartz/Quartz.h> but when I try to load an image using:
    >>>
    >>> CGImageSourceRef source =
    >>> CGImageSourceCreateWithURL( (CFURLRef)imgUrl, NULL);
    >>>
    >>> I get the following error:
    >>> <Error>: CGImageSourceCreateWithURL failed with error code -15.
    >>>
    >>>
    >>> I am already importing <QuartzCore/QuartzCore.h> because I'm
    >>> using  CIImag, however, now I need to use CGImage and for some
    >>> reason I  can't get it to work...
    >>>
    >>>
    >>> Jean-Nicolas Jolivet
    >>> <silvertab...>
    >>> http://www.silverscripting.com
    >>
    >>
    >> Jean-Nicolas Jolivet
    >> <silvertab...>
    >> http://www.silverscripting.com
    >
    >

    Jean-Nicolas Jolivet
    <silvertab...>
    http://www.silverscripting.com
  • Yup... that was the problem... the URL was indeed bad... Thanks for
    the tip!

    While I'm on the subject... I'm using CGImage because I read it would
    actually parse more EXIF tags than using NSBitmatImageRep's
    valueForProperty:@"NSImageEXIFData"

    Just tested it... my initial image has like 50+ EXIF tags (camera
    specific tags etc etc...)

    My resulting images (one using NSBitmapImageRep, the other using
    CGImage) both have 22 tags... so basically there is no advantage in
    using one over the other??

    And isn't there a more efficient way of reading EXIF data? Not even
    half of the tags are read ....

    Jean-Nicolas Jolivet

    On 18-Nov-08, at 3:41 AM, Jean-Nicolas Jolivet wrote:

    > Wait you might be onto something...
    >
    > I was using [NSURL URLWithString]
    > instead of [NSURL fileURLWithPath]
    >
    >
    >
    > On 18-Nov-08, at 3:35 AM, Roland King wrote:
    >
    >> one possible .. |kCFURLImproperArgumentsError is defined as -15. Is
    >> the imgUrl ok? Can you send a Null dictionary to that function or
    >> should you send an empty one? |
    >>
    >> Jean-Nicolas Jolivet wrote:
    >>
    >>> Well, apparently it's not a framework problem since I can use:
    >>>
    >>> CGImageSourceRef source =
    >>> CGImageSourceCreateWithData((CFDataRef)tempData, NULL);
    >>>
    >>> without a problem...
    >>>
    >>> Any other reasons why CGImageSourceCreateWithURL would yield an
    >>> error  code -15???
    >>>
    >>>
    >>> On 18-Nov-08, at 3:18 AM, Jean-Nicolas Jolivet wrote:
    >>>
    >>>> What framework has to be linked/imported to use CGImages? I
    >>>> tried  <Quartz/Quartz.h> but when I try to load an image using:
    >>>>
    >>>> CGImageSourceRef source =
    >>>> CGImageSourceCreateWithURL( (CFURLRef)imgUrl, NULL);
    >>>>
    >>>> I get the following error:
    >>>> <Error>: CGImageSourceCreateWithURL failed with error code -15.
    >>>>
    >>>>
    >>>> I am already importing <QuartzCore/QuartzCore.h> because I'm
    >>>> using  CIImag, however, now I need to use CGImage and for some
    >>>> reason I  can't get it to work...
    >>>>
    >>>>
    >>>> Jean-Nicolas Jolivet
    >>>> <silvertab...>
    >>>> http://www.silverscripting.com
    >>>
    >>>
    >>> Jean-Nicolas Jolivet
    >>> <silvertab...>
    >>> http://www.silverscripting.com
    >>
    >>
    >
    > Jean-Nicolas Jolivet
    > <silvertab...>
    > http://www.silverscripting.com

    Jean-Nicolas Jolivet
    <silvertab...>
    http://www.silverscripting.com