{"issue":{"pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"state":"open","user":{"avatar_url":"https://secure.gravatar.com/avatar/6ab4f268e60bff57b813262cfbe9db6c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"6ab4f268e60bff57b813262cfbe9db6c","url":"https://api.github.com/users/paulmcpazzi","login":"paulmcpazzi","id":1186409},"milestone":null,"assignee":null,"updated_at":"2011-11-11T09:41:38Z","labels":[{"name":"Feature","color":"deffdb","url":"https://api.github.com/repos/mrdoob/three.js/labels/Feature"}],"closed_at":null,"comments":2,"url":"https://api.github.com/repos/mrdoob/three.js/issues/741","body":"Right now the JSONLoader is assuming the textures are http URIs.\r\nIt would be nice to also support the [Data URI scheme](http://en.wikipedia.org/wiki/Data_URI_scheme) for base64 images.\r\n\r\n    var model = {\r\n      ...\r\n    \"materials\" : [\t{\r\n      ...\r\n      \"mapDiffuse\" : \"data:image/jpg;base64,...\"\r\n    }\r\n","html_url":"https://github.com/mrdoob/three.js/issues/741","title":"JSONLoader: support for base64 image textures","number":741,"id":2199462,"created_at":"2011-11-10T16:06:35Z"},"action":"created","comment":{"user":{"avatar_url":"https://secure.gravatar.com/avatar/6ab4f268e60bff57b813262cfbe9db6c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"6ab4f268e60bff57b813262cfbe9db6c","url":"https://api.github.com/users/paulmcpazzi","login":"paulmcpazzi","id":1186409},"updated_at":"2011-11-11T09:41:38Z","url":"https://api.github.com/repos/mrdoob/three.js/issues/comments/2706434","body":"We could expand `convert_obj_three.py` with another flag.\r\nIt shouldn't be hard even in Python to convert an image path into a data URI.\r\nA rough example:\r\n\r\n\timport base64\r\n\timport os\r\n\t\t\r\n\tdef get_base64_image(path):\r\n\t\tname, ext = os.path.splitext(path)\r\n\t\tmime = get_mime(ext)\r\n\t\twith open(path) as f:\r\n\t\t\tb64string = base64.b64encode(f.read())\r\n\t\t\treturn 'data:{0};base64,{1}'.format(mime, b64string)\r\n\r\n\tdef get_mime(ext):\r\n\t\tif ext in ('.jpg', '.jpeg,', '.jpe', '.jif', '.jfif', '.jfi'):\r\n\t\t\treturn 'image/jpeg'\r\n\t\telif ext in ('.png', ):\r\n\t\t\treturn 'image/png'\r\n\t\telif ext in ('.gif', ):\r\n\t\t\treturn 'image/gif'\r\n\t\telif ext in ('.bmp', '.dib'):\r\n\t\t\treturn 'image/x-bmp'\r\n","id":2706434,"created_at":"2011-11-11T09:41:38Z"}}