{"action":"created","issue":{"url":"https://api.github.com/repos/PistonDevelopers/image/issues/555","repository_url":"https://api.github.com/repos/PistonDevelopers/image","labels_url":"https://api.github.com/repos/PistonDevelopers/image/issues/555/labels{/name}","comments_url":"https://api.github.com/repos/PistonDevelopers/image/issues/555/comments","events_url":"https://api.github.com/repos/PistonDevelopers/image/issues/555/events","html_url":"https://github.com/PistonDevelopers/image/pull/555","id":162597114,"number":555,"title":"ppm/encoder: Prep filtered slice before write_all","user":{"login":"genkimarshall","id":4513869,"avatar_url":"https://avatars.githubusercontent.com/u/4513869?v=3","gravatar_id":"","url":"https://api.github.com/users/genkimarshall","html_url":"https://github.com/genkimarshall","followers_url":"https://api.github.com/users/genkimarshall/followers","following_url":"https://api.github.com/users/genkimarshall/following{/other_user}","gists_url":"https://api.github.com/users/genkimarshall/gists{/gist_id}","starred_url":"https://api.github.com/users/genkimarshall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/genkimarshall/subscriptions","organizations_url":"https://api.github.com/users/genkimarshall/orgs","repos_url":"https://api.github.com/users/genkimarshall/repos","events_url":"https://api.github.com/users/genkimarshall/events{/privacy}","received_events_url":"https://api.github.com/users/genkimarshall/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-06-28T03:53:49Z","updated_at":"2016-07-02T20:54:30Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/PistonDevelopers/image/pulls/555","html_url":"https://github.com/PistonDevelopers/image/pull/555","diff_url":"https://github.com/PistonDevelopers/image/pull/555.diff","patch_url":"https://github.com/PistonDevelopers/image/pull/555.patch"},"body":"I noticed that saving an RGBA to a PPM file was taking ~620 times longer than an RGB.\r\nIt scaled linearly with # pixels. So this patch does all the filtering in one go and then writes the entire slice.\r\n\r\nFor a 2560x1700 pixel image:\r\n```\r\nrgb:       0.01916 seconds\r\nold rgba: 11.657   seconds\r\nnew rgba:  0.05424 seconds\r\n```\r\n\r\nTest code:\r\n```\r\nextern crate image;\r\nextern crate time;\r\n\r\nuse std::fs::File;\r\nuse std::path::Path;\r\n\r\nfn main() {\r\n    let mut imgbuf = image::ImageBuffer::new(2560, 1700);\r\n    for (x, y, pixel) in imgbuf.enumerate_pixels_mut() {\r\n        *pixel = image::Rgba([x as u8, y as u8, x as u8, y as u8]);\r\n    }\r\n\r\n    let ref mut fout = File::create(&Path::new(\"rgba.ppm\")).unwrap();\r\n    let img = image::ImageRgba8(imgbuf);\r\n\r\n    println!(\"Start save\");\r\n    let start = time::precise_time_s();\r\n    let _ = img.save(fout, image::PPM);\r\n    println!(\"Save: {} seconds\", time::precise_time_s() - start);\r\n}\r\n```\r\n\r\nPlease me know if I did anything wrong; thanks for the great library otherwise."},"comment":{"url":"https://api.github.com/repos/PistonDevelopers/image/issues/comments/230121604","html_url":"https://github.com/PistonDevelopers/image/pull/555#issuecomment-230121604","issue_url":"https://api.github.com/repos/PistonDevelopers/image/issues/555","id":230121604,"user":{"login":"philipc","id":330342,"avatar_url":"https://avatars.githubusercontent.com/u/330342?v=3","gravatar_id":"","url":"https://api.github.com/users/philipc","html_url":"https://github.com/philipc","followers_url":"https://api.github.com/users/philipc/followers","following_url":"https://api.github.com/users/philipc/following{/other_user}","gists_url":"https://api.github.com/users/philipc/gists{/gist_id}","starred_url":"https://api.github.com/users/philipc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philipc/subscriptions","organizations_url":"https://api.github.com/users/philipc/orgs","repos_url":"https://api.github.com/users/philipc/repos","events_url":"https://api.github.com/users/philipc/events{/privacy}","received_events_url":"https://api.github.com/users/philipc/received_events","type":"User","site_admin":false},"created_at":"2016-07-02T20:54:30Z","updated_at":"2016-07-02T20:54:30Z","body":"@genkimarshall The end of the range is not inclusive. so I think that will only give you two channels."}}
{"actor":{"display_login":"philipc"}}