Image api fix

Not all white spaces changes - I added some code so that older API's won't use calls they don't have - see line 97. Also I think I hit Ctrl - I to fix some formatting because it looks like the older version had some bad indentation. All spaces in both versions as far as i can tell