Re: CGImageSourceCopyPropertiesAtIndex fails sometimes
Re: CGImageSourceCopyPropertiesAtIndex fails sometimes
- Subject: Re: CGImageSourceCopyPropertiesAtIndex fails sometimes
- From: "Gary L. Wade via Cocoa-dev" <email@hidden>
- Date: Wed, 25 Sep 2019 08:37:05 -0700
I don’t recall if the URL can be a remote URL in addition to a file URL, but
regardless, check the status of the source ref with CGImageSourceStatus first.
The index value is used for compound images like animated GIFs and PNGs.
--
Gary L. Wade
http://www.garywade.com/
> On Sep 25, 2019, at 8:10 AM, Gabriel Zachmann via Cocoa-dev
> <email@hidden> wrote:
>
>
> I have this piece of code in my program:
>
> CGImageSourceRef sourceRef = CGImageSourceCreateWithURL( (CFURLRef) url,
> NULL );
> if ( sourceRef == NULL )
> {
> ... display error message 1
> return;
> }
> CFDictionaryRef fileProps = CGImageSourceCopyPropertiesAtIndex( sourceRef,
> 0, NULL );
> if ( ! fileProps )
> {
> ... display error message 2
> return;
> }
>
> Now, occasionally, I get "error message 2" but not "error message 1",
> i.e., CGImageSourceCopyPropertiesAtIndex() apparently fails, while
> CGImageSourceCreateWithURL() retuned a valid(?) image source ref.
>
> I am wondering, how this could happen. Does anyone have a clue?
>
> Furthermore, when I run the program a few minutes later, without any changes
> whatsoever,
> both function calls work just fine, with the same image files!
>
>
> Puzzled, Gabriel.
>
> PS:
> I never understood what the index in CGImageSourceCopyPropertiesAtIndex() is
> meant for,
> and I could not find a clue in the docs, and every example uses just 0 ‒
> but probably, this is not related to the problem described above.
_______________________________________________
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