{"action":"created","comment":{"url":"https://api.github.com/repos/geotrellis/geotrellis/pulls/comments/87906668","pull_request_review_id":8497821,"id":87906668,"diff_hunk":"@@ -326,3 +326,31 @@ class DoubleColorMap(breaksToColors: Map[Double, Int], val options: Options = Op\n       .mkString(\";\")\n   }\n }\n+\n+/** A color map where the breaks are monotonically increasing integer values starting at zero.\n+ * Primarily used for capturing and persisting indexed color maps in GeoTIFFs. */\n+class IndexedColorMap(indexedColors: Seq[Int]) extends IntColorMap(\n+  indexedColors.zipWithIndex.map(p ⇒ p._2 -> p._1).toMap\n+) {\n+  override def toString = getClass.getSimpleName + \"(\" +\n+    colors.map(c ⇒ f\"0x$c%02x\").mkString(\", \") + \")\"\n+}\n+\n+object IndexedColorMap {\n+  // As with GDAL, we need to pack each 16 bit color channel into 8 bits.\n+  // GDAL just shifts and masks, effectively converting a 0-65535 range\n+  // to a 0-255 one. These conversion approaches are similar to those used\n+  // in the GDAL TIFF driver.\n+  private def downsample(c: Int) = (c >> 8 & 0xFF).toShort\n+  private def upsample(c: Int) = (c * 257).toShort\n+\n+  /** Creates an IndexColorMap from sequence of RGB short values. */\n+  private[raster] def fromTiffPalette(tiffPalette: Seq[(Short, Short, Short)]) = new IndexedColorMap(","path":"raster/src/main/scala/geotrellis/raster/render/ColorMap.scala","position":23,"original_position":23,"commit_id":"49cbd43327b18acafb9ee0bfb6a6c476c0a8ee08","original_commit_id":"49cbd43327b18acafb9ee0bfb6a6c476c0a8ee08","user":{"login":"lossyrob","id":2320142,"avatar_url":"https://avatars.githubusercontent.com/u/2320142?v=3","gravatar_id":"","url":"https://api.github.com/users/lossyrob","html_url":"https://github.com/lossyrob","followers_url":"https://api.github.com/users/lossyrob/followers","following_url":"https://api.github.com/users/lossyrob/following{/other_user}","gists_url":"https://api.github.com/users/lossyrob/gists{/gist_id}","starred_url":"https://api.github.com/users/lossyrob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lossyrob/subscriptions","organizations_url":"https://api.github.com/users/lossyrob/orgs","repos_url":"https://api.github.com/users/lossyrob/repos","events_url":"https://api.github.com/users/lossyrob/events{/privacy}","received_events_url":"https://api.github.com/users/lossyrob/received_events","type":"User","site_admin":false},"body":"not sure there's a need to make this private to [raster], is there a good reason to hide it?","created_at":"2016-11-14T22:22:08Z","updated_at":"2016-11-14T22:46:39Z","html_url":"https://github.com/geotrellis/geotrellis/pull/1802#discussion_r87906668","pull_request_url":"https://api.github.com/repos/geotrellis/geotrellis/pulls/1802","_links":{"self":{"href":"https://api.github.com/repos/geotrellis/geotrellis/pulls/comments/87906668"},"html":{"href":"https://github.com/geotrellis/geotrellis/pull/1802#discussion_r87906668"},"pull_request":{"href":"https://api.github.com/repos/geotrellis/geotrellis/pulls/1802"}}},"pull_request":{"url":"https://api.github.com/repos/geotrellis/geotrellis/pulls/1802","id":93583167,"html_url":"https://github.com/geotrellis/geotrellis/pull/1802","diff_url":"https://github.com/geotrellis/geotrellis/pull/1802.diff","patch_url":"https://github.com/geotrellis/geotrellis/pull/1802.patch","issue_url":"https://api.github.com/repos/geotrellis/geotrellis/issues/1802","number":1802,"state":"open","locked":false,"title":"Ability to read/write color tables for GeoTIFFs encoded with palette photometric interpretation","user":{"login":"metasim","id":131013,"avatar_url":"https://avatars.githubusercontent.com/u/131013?v=3","gravatar_id":"","url":"https://api.github.com/users/metasim","html_url":"https://github.com/metasim","followers_url":"https://api.github.com/users/metasim/followers","following_url":"https://api.github.com/users/metasim/following{/other_user}","gists_url":"https://api.github.com/users/metasim/gists{/gist_id}","starred_url":"https://api.github.com/users/metasim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/metasim/subscriptions","organizations_url":"https://api.github.com/users/metasim/orgs","repos_url":"https://api.github.com/users/metasim/repos","events_url":"https://api.github.com/users/metasim/events{/privacy}","received_events_url":"https://api.github.com/users/metasim/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-11-14T15:08:54Z","updated_at":"2016-11-14T22:46:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c35195af6035cc7aa5ed2444459a48f6b00f5e31","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/geotrellis/geotrellis/milestones/9","html_url":"https://github.com/geotrellis/geotrellis/milestones/1.0","labels_url":"https://api.github.com/repos/geotrellis/geotrellis/milestones/9/labels","id":1626760,"number":9,"title":"1.0","description":"","creator":{"login":"lossyrob","id":2320142,"avatar_url":"https://avatars.githubusercontent.com/u/2320142?v=3","gravatar_id":"","url":"https://api.github.com/users/lossyrob","html_url":"https://github.com/lossyrob","followers_url":"https://api.github.com/users/lossyrob/followers","following_url":"https://api.github.com/users/lossyrob/following{/other_user}","gists_url":"https://api.github.com/users/lossyrob/gists{/gist_id}","starred_url":"https://api.github.com/users/lossyrob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lossyrob/subscriptions","organizations_url":"https://api.github.com/users/lossyrob/orgs","repos_url":"https://api.github.com/users/lossyrob/repos","events_url":"https://api.github.com/users/lossyrob/events{/privacy}","received_events_url":"https://api.github.com/users/lossyrob/received_events","type":"User","site_admin":false},"open_issues":16,"closed_issues":131,"state":"open","created_at":"2016-03-07T16:39:19Z","updated_at":"2016-11-14T22:44:33Z","due_on":"2016-11-15T05:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/geotrellis/geotrellis/pulls/1802/commits","review_comments_url":"https://api.github.com/repos/geotrellis/geotrellis/pulls/1802/comments","review_comment_url":"https://api.github.com/repos/geotrellis/geotrellis/pulls/comments{/number}","comments_url":"https://api.github.com/repos/geotrellis/geotrellis/issues/1802/comments","statuses_url":"https://api.github.com/repos/geotrellis/geotrellis/statuses/49cbd43327b18acafb9ee0bfb6a6c476c0a8ee08","head":{"label":"s22s:feature/tiff-color-table","ref":"feature/tiff-color-table","sha":"49cbd43327b18acafb9ee0bfb6a6c476c0a8ee08","user":{"login":"s22s","id":21218400,"avatar_url":"https://avatars.githubusercontent.com/u/21218400?v=3","gravatar_id":"","url":"https://api.github.com/users/s22s","html_url":"https://github.com/s22s","followers_url":"https://api.github.com/users/s22s/followers","following_url":"https://api.github.com/users/s22s/following{/other_user}","gists_url":"https://api.github.com/users/s22s/gists{/gist_id}","starred_url":"https://api.github.com/users/s22s/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s22s/subscriptions","organizations_url":"https://api.github.com/users/s22s/orgs","repos_url":"https://api.github.com/users/s22s/repos","events_url":"https://api.github.com/users/s22s/events{/privacy}","received_events_url":"https://api.github.com/users/s22s/received_events","type":"Organization","site_admin":false},"repo":{"id":70293048,"name":"geotrellis","full_name":"s22s/geotrellis","owner":{"login":"s22s","id":21218400,"avatar_url":"https://avatars.githubusercontent.com/u/21218400?v=3","gravatar_id":"","url":"https://api.github.com/users/s22s","html_url":"https://github.com/s22s","followers_url":"https://api.github.com/users/s22s/followers","following_url":"https://api.github.com/users/s22s/following{/other_user}","gists_url":"https://api.github.com/users/s22s/gists{/gist_id}","starred_url":"https://api.github.com/users/s22s/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s22s/subscriptions","organizations_url":"https://api.github.com/users/s22s/orgs","repos_url":"https://api.github.com/users/s22s/repos","events_url":"https://api.github.com/users/s22s/events{/privacy}","received_events_url":"https://api.github.com/users/s22s/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/s22s/geotrellis","description":"GeoTrellis is a geographic data processing engine for high performance applications.","fork":true,"url":"https://api.github.com/repos/s22s/geotrellis","forks_url":"https://api.github.com/repos/s22s/geotrellis/forks","keys_url":"https://api.github.com/repos/s22s/geotrellis/keys{/key_id}","collaborators_url":"https://api.github.com/repos/s22s/geotrellis/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/s22s/geotrellis/teams","hooks_url":"https://api.github.com/repos/s22s/geotrellis/hooks","issue_events_url":"https://api.github.com/repos/s22s/geotrellis/issues/events{/number}","events_url":"https://api.github.com/repos/s22s/geotrellis/events","assignees_url":"https://api.github.com/repos/s22s/geotrellis/assignees{/user}","branches_url":"https://api.github.com/repos/s22s/geotrellis/branches{/branch}","tags_url":"https://api.github.com/repos/s22s/geotrellis/tags","blobs_url":"https://api.github.com/repos/s22s/geotrellis/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/s22s/geotrellis/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/s22s/geotrellis/git/refs{/sha}","trees_url":"https://api.github.com/repos/s22s/geotrellis/git/trees{/sha}","statuses_url":"https://api.github.com/repos/s22s/geotrellis/statuses/{sha}","languages_url":"https://api.github.com/repos/s22s/geotrellis/languages","stargazers_url":"https://api.github.com/repos/s22s/geotrellis/stargazers","contributors_url":"https://api.github.com/repos/s22s/geotrellis/contributors","subscribers_url":"https://api.github.com/repos/s22s/geotrellis/subscribers","subscription_url":"https://api.github.com/repos/s22s/geotrellis/subscription","commits_url":"https://api.github.com/repos/s22s/geotrellis/commits{/sha}","git_commits_url":"https://api.github.com/repos/s22s/geotrellis/git/commits{/sha}","comments_url":"https://api.github.com/repos/s22s/geotrellis/comments{/number}","issue_comment_url":"https://api.github.com/repos/s22s/geotrellis/issues/comments{/number}","contents_url":"https://api.github.com/repos/s22s/geotrellis/contents/{+path}","compare_url":"https://api.github.com/repos/s22s/geotrellis/compare/{base}...{head}","merges_url":"https://api.github.com/repos/s22s/geotrellis/merges","archive_url":"https://api.github.com/repos/s22s/geotrellis/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/s22s/geotrellis/downloads","issues_url":"https://api.github.com/repos/s22s/geotrellis/issues{/number}","pulls_url":"https://api.github.com/repos/s22s/geotrellis/pulls{/number}","milestones_url":"https://api.github.com/repos/s22s/geotrellis/milestones{/number}","notifications_url":"https://api.github.com/repos/s22s/geotrellis/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/s22s/geotrellis/labels{/name}","releases_url":"https://api.github.com/repos/s22s/geotrellis/releases{/id}","deployments_url":"https://api.github.com/repos/s22s/geotrellis/deployments","created_at":"2016-10-08T00:55:40Z","updated_at":"2016-10-08T00:55:56Z","pushed_at":"2016-11-14T19:10:42Z","git_url":"git://github.com/s22s/geotrellis.git","ssh_url":"git@github.com:s22s/geotrellis.git","clone_url":"https://github.com/s22s/geotrellis.git","svn_url":"https://github.com/s22s/geotrellis","homepage":"http://geotrellis.io","size":277922,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"geotrellis:master","ref":"master","sha":"720612f419f53e6d0b265bacea849f64244b0c58","user":{"login":"geotrellis","id":3129444,"avatar_url":"https://avatars.githubusercontent.com/u/3129444?v=3","gravatar_id":"","url":"https://api.github.com/users/geotrellis","html_url":"https://github.com/geotrellis","followers_url":"https://api.github.com/users/geotrellis/followers","following_url":"https://api.github.com/users/geotrellis/following{/other_user}","gists_url":"https://api.github.com/users/geotrellis/gists{/gist_id}","starred_url":"https://api.github.com/users/geotrellis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geotrellis/subscriptions","organizations_url":"https://api.github.com/users/geotrellis/orgs","repos_url":"https://api.github.com/users/geotrellis/repos","events_url":"https://api.github.com/users/geotrellis/events{/privacy}","received_events_url":"https://api.github.com/users/geotrellis/received_events","type":"Organization","site_admin":false},"repo":{"id":3040675,"name":"geotrellis","full_name":"geotrellis/geotrellis","owner":{"login":"geotrellis","id":3129444,"avatar_url":"https://avatars.githubusercontent.com/u/3129444?v=3","gravatar_id":"","url":"https://api.github.com/users/geotrellis","html_url":"https://github.com/geotrellis","followers_url":"https://api.github.com/users/geotrellis/followers","following_url":"https://api.github.com/users/geotrellis/following{/other_user}","gists_url":"https://api.github.com/users/geotrellis/gists{/gist_id}","starred_url":"https://api.github.com/users/geotrellis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geotrellis/subscriptions","organizations_url":"https://api.github.com/users/geotrellis/orgs","repos_url":"https://api.github.com/users/geotrellis/repos","events_url":"https://api.github.com/users/geotrellis/events{/privacy}","received_events_url":"https://api.github.com/users/geotrellis/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/geotrellis/geotrellis","description":"GeoTrellis is a geographic data processing engine for high performance applications.","fork":false,"url":"https://api.github.com/repos/geotrellis/geotrellis","forks_url":"https://api.github.com/repos/geotrellis/geotrellis/forks","keys_url":"https://api.github.com/repos/geotrellis/geotrellis/keys{/key_id}","collaborators_url":"https://api.github.com/repos/geotrellis/geotrellis/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/geotrellis/geotrellis/teams","hooks_url":"https://api.github.com/repos/geotrellis/geotrellis/hooks","issue_events_url":"https://api.github.com/repos/geotrellis/geotrellis/issues/events{/number}","events_url":"https://api.github.com/repos/geotrellis/geotrellis/events","assignees_url":"https://api.github.com/repos/geotrellis/geotrellis/assignees{/user}","branches_url":"https://api.github.com/repos/geotrellis/geotrellis/branches{/branch}","tags_url":"https://api.github.com/repos/geotrellis/geotrellis/tags","blobs_url":"https://api.github.com/repos/geotrellis/geotrellis/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/geotrellis/geotrellis/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/geotrellis/geotrellis/git/refs{/sha}","trees_url":"https://api.github.com/repos/geotrellis/geotrellis/git/trees{/sha}","statuses_url":"https://api.github.com/repos/geotrellis/geotrellis/statuses/{sha}","languages_url":"https://api.github.com/repos/geotrellis/geotrellis/languages","stargazers_url":"https://api.github.com/repos/geotrellis/geotrellis/stargazers","contributors_url":"https://api.github.com/repos/geotrellis/geotrellis/contributors","subscribers_url":"https://api.github.com/repos/geotrellis/geotrellis/subscribers","subscription_url":"https://api.github.com/repos/geotrellis/geotrellis/subscription","commits_url":"https://api.github.com/repos/geotrellis/geotrellis/commits{/sha}","git_commits_url":"https://api.github.com/repos/geotrellis/geotrellis/git/commits{/sha}","comments_url":"https://api.github.com/repos/geotrellis/geotrellis/comments{/number}","issue_comment_url":"https://api.github.com/repos/geotrellis/geotrellis/issues/comments{/number}","contents_url":"https://api.github.com/repos/geotrellis/geotrellis/contents/{+path}","compare_url":"https://api.github.com/repos/geotrellis/geotrellis/compare/{base}...{head}","merges_url":"https://api.github.com/repos/geotrellis/geotrellis/merges","archive_url":"https://api.github.com/repos/geotrellis/geotrellis/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/geotrellis/geotrellis/downloads","issues_url":"https://api.github.com/repos/geotrellis/geotrellis/issues{/number}","pulls_url":"https://api.github.com/repos/geotrellis/geotrellis/pulls{/number}","milestones_url":"https://api.github.com/repos/geotrellis/geotrellis/milestones{/number}","notifications_url":"https://api.github.com/repos/geotrellis/geotrellis/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/geotrellis/geotrellis/labels{/name}","releases_url":"https://api.github.com/repos/geotrellis/geotrellis/releases{/id}","deployments_url":"https://api.github.com/repos/geotrellis/geotrellis/deployments","created_at":"2011-12-23T14:56:54Z","updated_at":"2016-11-07T17:39:34Z","pushed_at":"2016-11-14T22:44:34Z","git_url":"git://github.com/geotrellis/geotrellis.git","ssh_url":"git@github.com:geotrellis/geotrellis.git","clone_url":"https://github.com/geotrellis/geotrellis.git","svn_url":"https://github.com/geotrellis/geotrellis","homepage":"http://geotrellis.io","size":295634,"stargazers_count":484,"watchers_count":484,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":152,"mirror_url":null,"open_issues_count":81,"forks":152,"open_issues":81,"watchers":484,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/geotrellis/geotrellis/pulls/1802"},"html":{"href":"https://github.com/geotrellis/geotrellis/pull/1802"},"issue":{"href":"https://api.github.com/repos/geotrellis/geotrellis/issues/1802"},"comments":{"href":"https://api.github.com/repos/geotrellis/geotrellis/issues/1802/comments"},"review_comments":{"href":"https://api.github.com/repos/geotrellis/geotrellis/pulls/1802/comments"},"review_comment":{"href":"https://api.github.com/repos/geotrellis/geotrellis/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/geotrellis/geotrellis/pulls/1802/commits"},"statuses":{"href":"https://api.github.com/repos/geotrellis/geotrellis/statuses/49cbd43327b18acafb9ee0bfb6a6c476c0a8ee08"}}}}
{"actor":{"display_login":"lossyrob"}}