(p5image).width

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.js] (p5.Image.obj).width

概要

イメージの幅が格納されているプロパティです。

書式

obj.width

備考

関連

(p5image).height