staghado commited on
Commit
1a3150c
·
1 Parent(s): 62895e8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -85,9 +85,9 @@ def fourier_transform_drawing(input_image, frames, coefficients, img_size, blur_
85
  # Convert the Matplotlib figure to a PIL Image
86
  canvas = fig.canvas
87
  canvas.draw()
88
- image = Image.frombytes('RGB',
89
- canvas.get_width_height(),
90
- canvas.tostring_rgb())
91
  last_image = image
92
 
93
  # Yield the current image and a placeholder for the final animation
 
85
  # Convert the Matplotlib figure to a PIL Image
86
  canvas = fig.canvas
87
  canvas.draw()
88
+ w, h = canvas.get_width_height()
89
+ buf = np.frombuffer(canvas.buffer_rgba(), dtype=np.uint8)
90
+ image = Image.fromarray(buf.reshape(h, w, 4), 'RGBA').convert('RGB')
91
  last_image = image
92
 
93
  # Yield the current image and a placeholder for the final animation