Open dspinellis opened 7 years ago
+1
A quick workaround using PIL to convert grayscale to RGB:
from PIL import Image
formatter = {"PNG": "RGBA", "JPEG": "RGB"}
img = Image.open(file_name)
rgbimg = Image.new(formatter.get(img.format, 'RGB'), img.size)
rgbimg.paste(img)
rgbimg.save(file_name, format=img.format)
I think we should have such option as keyword at ImageSequenceClip
+1
This is the workaround I added, call convert_to_RGB(filePath) on Gray scale image:
import cv2
def convert_to_RGB(media):
imgtype = os.popen('identify ' + media +
' | grep Gray').read().rstrip()
if imgtype != '':
img = cv2.imread(media)
(b, g, r) = cv2.split(img)
img = cv2.merge([r, g, b])te
cv2.imwrite(media, img)
+1
For me pip install imageio==2.4.1
fixed it.
Although my images are not greyscale I used to get a similar error before this like so:
File "/home/ubuntu/neus/neusenv/lib/python3.8/site-packages/moviepy/video/tools/drawing.py", line 41, in blit new_im2[yp1:yp2, xp1:xp2] = blitted ValueError: could not broadcast input array from shape (400,450,2) into shape (400,450,3)
For me
pip install imageio==2.4.1
fixed it.Although my images are not greyscale I used to get a similar error before this like so:
File "/home/ubuntu/neus/neusenv/lib/python3.8/site-packages/moviepy/video/tools/drawing.py", line 41, in blit new_im2[yp1:yp2, xp1:xp2] = blitted ValueError: could not broadcast input array from shape (400,450,2) into shape (400,450,3)
not working
When composing a gray-scale image with a color video clip the writing of the result fails with a ValueError.
Example code
Stack trace