np arrays being immutable - “assignment destination is read-only”

前端 未结 4 2107
礼貌的吻别
礼貌的吻别 2020-11-30 04:30

FD** - I am a Python newb as well as a stack overflow newb as you can tell. I have edited the question based on comments.

My goal is to read a set of PNG files, crea

4条回答
  •  庸人自扰
    2020-11-30 05:07

    Check if the array is writable with

    >>> img.flags
      C_CONTIGUOUS : True
      F_CONTIGUOUS : False
      OWNDATA : True
      WRITEABLE : False
      ALIGNED : True
      UPDATEIFCOPY : False
    

    If WRITEABLEis false, change it with

    img.setflags(write=1)
    

提交回复
热议问题