moviepy textclip not rendered on centos7 or amazon linux but renders perfectly fine on mac - moviepy

Code to generate a simple mp4 movie with text, background and image
from moviepy.editor import *
image = ImageClip("res/pagan.png")
image = image.set_duration(5)
image = image.set_position((50, "center"))
backgroundImage = ImageClip("res/background.png")
backgroundImage = backgroundImage.set_duration(5)
fromText = TextClip("From: " , fontsize=70, color="white")
fromText = fromText.set_position((800, 320))
fromText = fromText.set_duration(5)
comp = CompositeVideoClip([backgroundImage, image, fromText])
output = comp.set_duration(5)
output.write_videofile("tmp.mp4", audio_codec="aac", fps=24)
The movie renders without any errors on both macbook pro and centos7. However, the text is not rendered properly on the centos7 server or amazon linux. It is just displayed as blurred out white lines. Has anyone faced a similar issue before? I have lodged this is a bug on moviepy as well but thought of posting here to see if anyone has faced similar issues in the past.

The issue seems to be with the Imagemagick version between the two environments. Looks like I needed ImageMagick 7.1.0. Refer to github.com/Zulko/moviepy/issues/1647 for details on how I narrowed this down.

Related

How to get image size of multiple pages pdf on mac terminal?

I would like to get image size of multiple pages pdf on Mac terminal. (I want to know that is portrait or landscape.)
(the information of in the red circle of following images)
I tried "sips" command (-g pixelWidth).
But the command shows only 1st page information.
I need the information of 2nd page or later.
information what I want to get by terminal
import os
import Quartz as qt
PATH = 'hoge.pdf'
fileprovider = qt.CGDataProviderCreateWithFilename(PATH)
pdffile = qt.CGPDFDocumentCreateWithProvider(fileprovider)
pagenumber = qt.CGPDFDocumentGetNumberOfPages(pdffile)
pageinforef = qt.CGPDFDocumentGetPage(pdffile, pagenumber)
pageRect = qt.CGPDFPageGetBoxRect(pageinforef, qt.kCGPDFMediaBox)
width = qt.NSWidth(pageRect)
run python file in terminal

Getting Julia to talk to Mac Plotting Devices

Running julia code from the command line, cannot get plots to show.
Simple example:
using ImageView
using Images
img = load("../images/cat.jpg")
imshow(img)
In a notebook
img shows the image, but running the above script from the command line, the code runs without fail, but no plot is ever visible.
Have searched, but have not been able to find documentation on how to get it to talk to, e.g., Quartz (like R does) or other plotting device.
Any help or redirecting to resources would be greatly appreciated.
Thanks!

Corona SDK, Lua

HELLLPPPPP!!!!! I am programming in Corona SDK, and I am trying to insert a backround image, with the following code ---local backround = display.newImage("bluebackround.jpg")--- But it does not want to show up in the simulator. It keeps giving me the following message in the output, ---Failed to find image 'bluebackround.jpg'---. My image is saved in the project folder. I am using Microsoft Windows software. I have done another project using Corona, and I inserted images completely fine. Anyone know what's going on with my code and how to fix it? Thank you very much in advance.
_W = display.contentWidth;
_H = display.contentHeight;
local image = display.newImageRect(--[["Name", width, heigth]] "bluebackround.jpg",_W, _H)
image.x = _W/2;
image.y = _H/2;
The your image need to be in the same folder as main.lua in your case. On the same level. Moreover, I think you misspell name of your image. You write 'bluebackround' without letter g in middle. So check name of the file.
From Corona documentation
Image guildelines:
Corona supports PNG and JPG format,
Images should not contain an embedded ICC profile,
Avoid progressive JPG files since they will take much longer to load.

TIFF16 image looks different in windows file viewer and MATLAB

General problem description
I have 33 TIFF16 images and I want to do some processing on them using MATLAB. So reading them is the first step. After I download an image from the web and then try to read it using MATLAB's imread (as well as Tiff and read). I display the image using imshow. The image displayed by the Windows File Viewer and MATLAB is totally different. I cannot process them since I don't trust MATLAB has read them correctly. I give more specifics of the problem now.
EDIT: If it helps, the details of the TIFF16 images are: TIFF (16 bits per channel, ProPhoto RGB color space, lossless compression)
More details:
I download an image a0008-WP_CRW_3959.tif. Destination: Go to this link -> img0008 -> Expert B (In case somebody wants to try, otherwise I have screenshots below).
I read that image in MATLAB using: img=imread('imgFilename.tif','tiff'); imshow(img,[]); or
t = Tiff('imgFilename.tif','r');
imageData = read(t);
imshow(imageData);
Now, I display the snapshots of Windows file viewer:
Next, snapshot of what MATLAB shows me:
Now, I have a good reason to believe that Windows file viewer is correct. Go the same link as previous. Scroll down to img0008. Hover your mouse onto the leftmost img0008. A thumbnail view of Expert B will come which looks same as what Windows shows me.
Does anybody know how to make MATLAB read and show the tiff16 image correctly?
Thank you #MarkRansom for pointing me to the embedded color profile possibility. I believe the following solution is correct and produces the same output as Windows File Viewer.
First read the icc-color-profile using iccread command.
I_rgb = imread('a0008-WP_CRW_3959.tif');
outprof = iccread('sRGB.icm');
P = iccread('a0008-WP_CRW_3959.tif');
Then convert the image into sRGB profile using makecform and applycform:
C = makecform('icc',P,outprof);
I_cmyk = applycform(I_rgb,C);
imwrite(I_cmyk,'pep_cmyk.tif','tif')
info = imfinfo('pep_cmyk.tif');
imshow('pep_cmyk.tif');
The original image saved on disk and the new - pep_cmyk.tif - look exactly the same with Windows file viewer.

OpenCV trackbar performance in OSX

I've just noticed that performance of openCV is drastically slowed down when a trackbar is present in a window with changing image from camera or a movie frame. What could be done resolve this issue?
The solution to that is to move trackbars to a separate window. For me on OSX the performance increased 4.7 times (from 3 FPS up to 14). I don't know if it works like this always or it's just like that on my computer but I haven't seen such a clue anywhere before so I decided to share.
string title = "My window";
int p = 2;
// Create a different window for controls
namedWindow(title + " - controls");
// I show an image once just to resize the window
imshow(title + " - controls", Mat::zeros(1, 500, CV_8UC1));
createTrackbar("Parameter", title + " - controls", &p, 3);
// Create a different window for actual image
namedWindow(title);
while (!done) {
// Do some calculations
flip(image, image, p);
imshow(title, image);
}
I also encountered the same problem in OSX-10.9.
And I have resolved the issue in the following ways:
port variants opencv
sudo port install opencv +qt4 +tbb +eigen +opencl
important option is "+qt4" only, the other options are extra.
OpenCV support Qt for GUI backend. And I suspect the cause of the problem is in the implementation of the default GUI backend.
I was able to virtually eliminates the problem by re-build OpenCV library with Qt support and re-install(update).
For me, this seemed to be an issue with the Anaconda distribution of OpenCV.
Installing OpenCV with pip fixed my performance issues.
Try to tune
cv2.waitKey(value)
I used cv2.waitKey(100) and works smoothly

Resources