{"action":"created","issue":{"url":"https://api.github.com/repos/PistonDevelopers/image/issues/598","repository_url":"https://api.github.com/repos/PistonDevelopers/image","labels_url":"https://api.github.com/repos/PistonDevelopers/image/issues/598/labels{/name}","comments_url":"https://api.github.com/repos/PistonDevelopers/image/issues/598/comments","events_url":"https://api.github.com/repos/PistonDevelopers/image/issues/598/events","html_url":"https://github.com/PistonDevelopers/image/issues/598","id":195378203,"number":598,"title":"What is the meaning of conversion from RGB to luma?","user":{"login":"kryptan","id":11528855,"avatar_url":"https://avatars.githubusercontent.com/u/11528855?v=3","gravatar_id":"","url":"https://api.github.com/users/kryptan","html_url":"https://github.com/kryptan","followers_url":"https://api.github.com/users/kryptan/followers","following_url":"https://api.github.com/users/kryptan/following{/other_user}","gists_url":"https://api.github.com/users/kryptan/gists{/gist_id}","starred_url":"https://api.github.com/users/kryptan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kryptan/subscriptions","organizations_url":"https://api.github.com/users/kryptan/orgs","repos_url":"https://api.github.com/users/kryptan/repos","events_url":"https://api.github.com/users/kryptan/events{/privacy}","received_events_url":"https://api.github.com/users/kryptan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-12-13T21:48:20Z","updated_at":"2017-01-21T20:39:59Z","closed_at":null,"body":"The [following formula is used](https://github.com/PistonDevelopers/image/blob/master/src/color.rs#L234):\r\n\r\n    luma = 0.2126*R + 0.7152*G + 0.0722*B\r\n\r\nIt is not clear what luma here is supposed to mean. \r\n\r\nI can see two explanations for this formula:\r\n\r\n  1. This is the same formula which is used in conversion from Rec. 709 RGB to YCbCr to find Y (luma) component. However it seems that it is assumed that `Rgb` pixel is in sRGB color space (although docs don't say anything about color spaces) and not in Rec. 709.\r\n\r\n  2. Coefficients are the same as in [matrix to convert from linear sRGB to XYZ](https://en.wikipedia.org/wiki/SRGB#The_reverse_transformation). If R, G and B values were in linear sRGB then the above formula would give the luminance value.\r\n\r\nThe above two cases do not apply and I don't see any other explanations for this ."},"comment":{"url":"https://api.github.com/repos/PistonDevelopers/image/issues/comments/274286843","html_url":"https://github.com/PistonDevelopers/image/issues/598#issuecomment-274286843","issue_url":"https://api.github.com/repos/PistonDevelopers/image/issues/598","id":274286843,"user":{"login":"retep998","id":666308,"avatar_url":"https://avatars.githubusercontent.com/u/666308?v=3","gravatar_id":"","url":"https://api.github.com/users/retep998","html_url":"https://github.com/retep998","followers_url":"https://api.github.com/users/retep998/followers","following_url":"https://api.github.com/users/retep998/following{/other_user}","gists_url":"https://api.github.com/users/retep998/gists{/gist_id}","starred_url":"https://api.github.com/users/retep998/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/retep998/subscriptions","organizations_url":"https://api.github.com/users/retep998/orgs","repos_url":"https://api.github.com/users/retep998/repos","events_url":"https://api.github.com/users/retep998/events{/privacy}","received_events_url":"https://api.github.com/users/retep998/received_events","type":"User","site_admin":false},"created_at":"2017-01-21T20:39:59Z","updated_at":"2017-01-21T20:39:59Z","body":">This is e.g. how it is generally done on GPU \r\n\r\nThe GPU actually has specific color formats for sRGB. So when you load up some u8 data you specifically have to tell the driver that it is sRGB. I think it may be better to have a type parameter to differentiate between color spaces (with the only two options for now being linear and sRGB), provide methods to convert between those two spaces, and implement most operations *only* on the linear version. When you open an image it should open it as sRGB, and when you save an image you have to save it as sRGB."}}
{"actor":{"display_login":"retep998"}}