title: python-moviepy-resize(), Exception: tostring() has been removed. Please call tobytes() instead
body: <p>My code:</p>
  
  <pre><code>    clip1 = VideoFileClip(changename).subclip(0,40)
      clip2 = VideoFileClip(changename).subclip(int(duration/2-20), int(duration/2+20) )
      clip3 = VideoFileClip(changename).subclip(duration-41,duration-1)
      final_clip = concatenate_videoclips([clip1,clip2,clip3])
  
      final_clip.resize(width=480).write_videofile(exportfile, fps=25)
  </code></pre>
  
  <h2>Exception                                 Traceback (most recent call last)</h2>
  
  <pre><code>    &lt;ipython-input-6-66d5567477fd&gt; in &lt;module&gt;()
            8     #final_clip.set_audio(audio.set_duration(final_clip))
            9 
      ---&gt; 10     final_clip.resize(width=480).write_videofile(exportfile, fps=25)
           11 
           12     if meta['width']&gt;480:
  
      /Applications/anaconda/lib/python2.7/site-packages/moviepy/video/fx/resize.pyc in resize(clip, newsize, height, width, apply_to_mask)
          142         fl = lambda pic: resizer(pic.astype('uint8'), newsize)
          143 
      --&gt; 144     newclip = clip.fl_image(fl)
          145 
          146     if apply_to_mask and clip.mask is not None:
  
      /Applications/anaconda/lib/python2.7/site-packages/moviepy/video/VideoClip.pyc in fl_image(self, image_func, apply_to)
          512         `get_frame(t)` by another frame,  `image_func(get_frame(t))`
          513         """
      --&gt; 514         return self.fl(lambda gf, t: image_func(gf(t)), apply_to)
          515 
          516     # --------------------------------------------------------------
  
      /Applications/anaconda/lib/python2.7/site-packages/moviepy/Clip.pyc in fl(self, fun, apply_to, keep_duration)
          134 
          135         #mf = copy(self.make_frame)
      --&gt; 136         newclip = self.set_make_frame(lambda t: fun(self.get_frame, t))
          137 
          138         if not keep_duration:
  
      &lt;decorator-gen-180&gt; in set_make_frame(self, mf)
  
      /Applications/anaconda/lib/python2.7/site-packages/moviepy/decorators.pyc in outplace(f, clip, *a, **k)
           12     """ Applies f(clip.copy(), *a, **k) and returns clip.copy()"""
           13     newclip = clip.copy()
      ---&gt; 14     f(newclip, *a, **k)
           15     return newclip
           16 
  
      /Applications/anaconda/lib/python2.7/site-packages/moviepy/video/VideoClip.pyc in set_make_frame(self, mf)
          652         """
          653         self.make_frame = mf
      --&gt; 654         self.size = self.get_frame(0).shape[:2][::-1]
          655 
          656 
  
      &lt;decorator-gen-137&gt; in get_frame(self, t)
  
      /Applications/anaconda/lib/python2.7/site-packages/moviepy/decorators.pyc in wrapper(f, *a, **kw)
           87         new_kw = {k: fun(v) if k in varnames else v
           88                  for (k,v) in kw.items()}
      ---&gt; 89         return f(*new_a, **new_kw)
           90     return decorator.decorator(wrapper)
           91 
  
      /Applications/anaconda/lib/python2.7/site-packages/moviepy/Clip.pyc in get_frame(self, t)
           93                 return frame
           94         else:
      ---&gt; 95             return self.make_frame(t)
           96 
           97     def fl(self, fun, apply_to=[] , keep_duration=True):
  
      /Applications/anaconda/lib/python2.7/site-packages/moviepy/Clip.pyc in &lt;lambda&gt;(t)
          134 
          135         #mf = copy(self.make_frame)
      --&gt; 136         newclip = self.set_make_frame(lambda t:         fun(self.get_frame, t))
          137 
          138         if not keep_duration:
  
      /Applications/anaconda/lib/python2.7/site-packages/moviepy/video/VideoClip.pyc in &lt;lambda&gt;(gf, t)
          512         `get_frame(t)` by another frame,  `image_func(get_frame(t))`
          513         """
      --&gt; 514         return self.fl(lambda gf, t: image_func(gf(t)), apply_to)
          515 
          516     # --------------------------------------------------------------
  
      /Applications/anaconda/lib/python2.7/site-packages/moviepy/video/fx/resize.pyc in &lt;lambda&gt;(pic)
          140 
          141     else:
      --&gt; 142         fl = lambda pic: resizer(pic.astype('uint8'), newsize)
          143 
          144     newclip = clip.fl_image(fl)
  
      /Applications/anaconda/lib/python2.7/site-packages/moviepy/video/fx/resize.pyc in resizer(pic, newsize)
           30             pilim = Image.fromarray(pic)
           31             resized_pil = pilim.resize(newsize[::-1], Image.ANTIALIAS)
      ---&gt; 32             arr = np.fromstring(resized_pil.tostring(), dtype='uint8')
           33             return arr.reshape(newshape)
           34         resizer.origin = "PIL"
  
      /Applications/anaconda/lib/python2.7/site-packages/PIL/Image.pyc in tostring(self, *args, **kw)
          684     def tostring(self, *args, **kw):
          685         raise Exception("tostring() has been removed. " +
      --&gt; 686                         "Please call tobytes() instead.")
          687 
          688     def tobitmap(self, name="image"):
  
      Exception: tostring() has been removed. Please call tobytes() instead.
  </code></pre>
  
  <p><strong><em>Help of resize() fuction:</em></strong></p>
  
  <pre><code>    resize(clip, newsize=None, height=None, width=None, apply_to_mask=True)
       |      Returns a video clip that is a resized version of the clip.
       |      
       |      Parameters
       |      ------------
       |      
       |      newsize:
       |        Can be either 
       |          - ``(height,width)`` in pixels or a float representing
       |          - A scaling factor, like 0.5
       |          - A function of time returning one of these.
       |              
       |      width:
       |        width of the new clip in pixel. The height is then computed so
       |        that the width/height ratio is conserved. 
       |              
       |      height:
       |        height of the new clip in pixel. The width is then computed so
       |        that the width/height ratio is conserved.
       |      
       |      Examples
       |      ----------
       |               
       |      &gt;&gt;&gt; myClip.resize( (460,720) ) # New resolution: (460,720)
       |      &gt;&gt;&gt; myClip.resize(0.6) # width and heigth multiplied by 0.6
       |      &gt;&gt;&gt; myClip.resize(width=800) # height computed automatically.
       |      &gt;&gt;&gt; myClip.resize(lambda t : 1+0.02*t) # slow swelling of the clip
  </code></pre>
  
  <p>I tried all of the examples : resize( (width,height) ),  resize(domsampling),  resize(width=800), resize(lambda t : 1+0.02*t). But all of them getting the same error. </p>