{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/Cairo.jl/issues/125","labels_url":"https://api.github.com/repos/JuliaLang/Cairo.jl/issues/125/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/Cairo.jl/issues/125/comments","events_url":"https://api.github.com/repos/JuliaLang/Cairo.jl/issues/125/events","html_url":"https://github.com/JuliaLang/Cairo.jl/issues/125","id":117079736,"number":125,"title":"Surface for 8-bit grayscale image","user":{"login":"xanadupark","id":6316410,"avatar_url":"https://avatars.githubusercontent.com/u/6316410?v=3","gravatar_id":"","url":"https://api.github.com/users/xanadupark","html_url":"https://github.com/xanadupark","followers_url":"https://api.github.com/users/xanadupark/followers","following_url":"https://api.github.com/users/xanadupark/following{/other_user}","gists_url":"https://api.github.com/users/xanadupark/gists{/gist_id}","starred_url":"https://api.github.com/users/xanadupark/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xanadupark/subscriptions","organizations_url":"https://api.github.com/users/xanadupark/orgs","repos_url":"https://api.github.com/users/xanadupark/repos","events_url":"https://api.github.com/users/xanadupark/events{/privacy}","received_events_url":"https://api.github.com/users/xanadupark/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-16T09:11:38Z","updated_at":"2015-11-16T10:02:13Z","closed_at":null,"body":"Hello all,\r\n\r\nI recently tried to use Julia/Cairo for an image generation of 8-bits gray scale.\r\nIn fact, what I need is an uint8 array with each element represent the gray scale for the further calculation. (It is conventional 8-bit grayscale image, I think)\r\nHowever, I cannot find the way to make grayscale surface with Cairo.\r\n\r\nAt first, I assumed that CAIRO_FORMAT_A8 is the grayscale surface and also assumed that the data array has to be an uint8 array. However, there's error like follows:\r\n```\r\njulia> sf = CairoImageSurface(dt,2);\r\nERROR: MethodError: `CairoImageSurface` has no method matching CairoImageSurface(::Array{UInt8,2}, ::Int32)\r\n   Closest candidates are:\r\n   CairoImageSurface(::Real, ::Real, ::Integer)\r\n   CairoImageSurface(::Array{UInt32,2}, ::Integer)\r\n```\r\n```dt``` is ```Array{UInt8,2}```\r\n\r\nAnd then, I convert the ```dt``` array to uint32: \r\n```\r\njulia> sf = CairoImageSurface(dt,2)\r\nERROR: AssertionError: stride == 4w\r\n in CairoImageSurface at C:\\Users\\10189524\\.julia\\v0.4\\Cairo\\src\\Cairo.jl:175\r\n```\r\nOf course, I can make the image surface with ARGB or RGB format. \r\nIs this a bug or my short knowledge of Cairo?\r\n\r\nThanks in advance "},"comment":{"url":"https://api.github.com/repos/JuliaLang/Cairo.jl/issues/comments/156976228","html_url":"https://github.com/JuliaLang/Cairo.jl/issues/125#issuecomment-156976228","issue_url":"https://api.github.com/repos/JuliaLang/Cairo.jl/issues/125","id":156976228,"user":{"login":"lobingera","id":5199059,"avatar_url":"https://avatars.githubusercontent.com/u/5199059?v=3","gravatar_id":"","url":"https://api.github.com/users/lobingera","html_url":"https://github.com/lobingera","followers_url":"https://api.github.com/users/lobingera/followers","following_url":"https://api.github.com/users/lobingera/following{/other_user}","gists_url":"https://api.github.com/users/lobingera/gists{/gist_id}","starred_url":"https://api.github.com/users/lobingera/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lobingera/subscriptions","organizations_url":"https://api.github.com/users/lobingera/orgs","repos_url":"https://api.github.com/users/lobingera/repos","events_url":"https://api.github.com/users/lobingera/events{/privacy}","received_events_url":"https://api.github.com/users/lobingera/received_events","type":"User","site_admin":false},"created_at":"2015-11-16T10:02:13Z","updated_at":"2015-11-16T10:02:13Z","body":"CAIRO_FORMAT_A8 (see http://cairographics.org/manual/cairo-Image-Surfaces.html#cairo-format-t) is 8 bit, but alpha channel only. This is usually used as a alpha mask for painting. You could e.g. use this to paint black color source to a white background with your image in the _A8 alpha map to paint a grayscale image, but the easier way is to use one of the color formats (_RGB)."}}