Skip to content

Instantly share code, notes, and snippets.

@CnrLwlss
Created January 3, 2025 17:58
Show Gist options
  • Save CnrLwlss/5a142c351522b225b601840102458b4e to your computer and use it in GitHub Desktop.
Save CnrLwlss/5a142c351522b225b601840102458b4e to your computer and use it in GitHub Desktop.
Sample some pixels from a colour image and write to file
using VideoIO
using Images
download("https://live.staticflickr.com/4293/35896494470_6e106950d9_o_d.jpg","input.jpg")
img = load("input.jpg")
(h,w) = size(img)
function getframe(img, dx, dy, N, scaleup)
smimg = img[dy:(dy+(N-1)),dx:(dx+(N-1))]
bigpix = repeat(smimg, inner=(scaleup,scaleup))
return bigpix
end
save("singleframe.png",getframe(img,1,1873,8,200))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment