Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6787511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:22:30+00:00 2026-05-26T17:22:30+00:00

My application is trying to create custom objects from NSImage objects (coming from the

  • 0

My application is trying to create custom objects from NSImage objects (coming from the pasteboard) but my current process only takes in image URLs.

I’d like to avoid major changes at this point so I was wondering if there was any way to get the URL of an NSImage (it seems like a reasonable expectation since one can initialize an NSImage from a URL)

Thanks.

EDIT (answer)

I went a slightly different route. Instead of getting the content of the pasteboard as an array of NSImage, I simply got it as an array of NSURL. I can then feed those into my process.

    NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
    NSArray *classArray = [NSArray arrayWithObject:[NSURL class]];
    NSDictionary *options = [NSDictionary dictionary];

    BOOL ok = [pasteboard canReadObjectForClasses:classArray options:options];
    if (ok) {
        NSArray *URLs = [pasteboard readObjectsForClasses:classArray options:options];
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:22:30+00:00Added an answer on May 26, 2026 at 5:22 pm

    Quote by BlazingFrog:

    (it seems like a reasonable expectation since one can initialize an NSImage from a URL)

    Lets say I initialize a NSString by using:

    NSString * theString = [NSString initWithContentsOfURL: encoding: error: ];
    

    I’m sure it’s not possible to retrieve the original NSURL from the NSString.
    And I’m quite sure the same applies to NSImage. (Actually, completely sure.)

    Indeed NSImage can be initialized by initWithContentsOfURL:.
    But it can also be initialized by initWithData: or initWithPasteboard:.
    The NSURL is no strict requirement for initializing a NSImage.
    In other words, the NSImage might be initialized without using a URL.
    The NSImage is simply a container for image representations.

    Quote by Apple:

    An NSImage object manages a group of image representations.

    Solutions

    1. Change you ‘process’ to accept NSImage.
    2. Write the NSImage to a temporary file and use that file path.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hi i am trying to create a custom attribute for my MVC application so
Trying to create a small monitor application that displays current internet usage as percentage
I am trying to create a WPF application that takes command line arguments. If
I'm trying to create a WPF application where I can drag an image around.
I am trying to create a custom application that allows for adding and removing
I'm currently trying to created a custom ConfigurationSection for my application, however VS2008 is
Trying to create a QtRuby application, I get the following error: /usr/lib64/ruby/site_ruby/1.8/Qt/qtruby4.rb:2144: [BUG] Segmentation
im trying to create a database for a feedback application in ASP.net i have
I'm trying to create an application that will let me execute a method specified
I am trying to create an application that makes a window (external to the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.