Skip to content

Instantly share code, notes, and snippets.

@niklasschmitz
Last active September 10, 2022 10:32
Show Gist options
  • Save niklasschmitz/03be29c2850ac3bbdf6ce86229b71d8f to your computer and use it in GitHub Desktop.
Save niklasschmitz/03be29c2850ac3bbdf6ce86229b71d8f to your computer and use it in GitHub Desktop.
Testimage camera.ppm
using Images
# CC0 license: https://commons.wikimedia.org/wiki/File:Wikicommons_kamera_rollei35_rrt877.jpg
file = download("https://upload.wikimedia.org/wikipedia/commons/thumb/3/38/Wikicommons_kamera_rollei35_rrt877.jpg/640px-Wikicommons_kamera_rollei35_rrt877.jpg")
img = load(file)
open("camera.ppm", "w+") do io
println(io, "P6")
println(io, size(img, 2), " ", size(img, 1))
println(io, 255)
for row in eachrow(img)
for px in row
write(io, px.r.i)
write(io, px.g.i)
write(io, px.b.i)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment