def setup img = loadImage("fruit.png") image(img, 0, 0) for i in (0...img.width) do c = img.get(i, img.height / 2) stroke(c) line(i, height / 2, i, height) end end
[p5.js] (p5.Image.obj).width
イメージの幅が格納されているプロパティです。