Google – Is a URL required when creating an image sitemap?

The reason I'm asking is that I'm writing a script that scans a folder for pictures so I do not necessarily know where they're used or the exact page. Example from Google



  
    http://example.com/sample.html
    
      http://example.com/image.jpg
    
    
      http://example.com/photo.jpg
    
   

Is it possible to do that and would google / other search engines still read it correctly?


    
      
        
          http://example.com/image.jpg
        
        
          http://example.com/photo.jpg