zak100 Posted March 28, 2020 Posted March 28, 2020 Hi, I want to create a GIF file from a text file of 500 x 500 dimensions. I got some help to create the following program which works fine but I have not tried it for text file. Also how I can add the 500 x 500 dimension. My code is: import imageio images = [] filenames = ["one.jpeg", "two.png", "three.png"] for filename in filenames: images.append(imageio.imread(f'./images/{filename}')) #imageio. imageio.mimsave('./images/movie.gif', images) Somebody please guide me. Zulfi.
Strange Posted March 28, 2020 Posted March 28, 2020 1 minute ago, zak100 said: I want to create a GIF file from a text file of 500 x 500 dimensions. It is not clear what this means. (Clearly specifying what you want to do is 90% of the work in programming; the rest is just syntax.) What is the text file? In other words, what does it contain? How does it relate to the image file you want to create? Is 500x500 measured in pixels or some other units? 4 minutes ago, zak100 said: I got some help to create the following program which works fine but I have not tried it for text file. That program appears to read several gif files and combine them in one. I can't see how this is related to your initial description of what you want to do. Quote Also how I can add the 500 x 500 dimension. it depends. Are you using mages that are already this size? Are you scaling an existing image to this size? Are you creating a new image of this size? 1
Ghideon Posted March 28, 2020 Posted March 28, 2020 10 minutes ago, zak100 said: I want to create a GIF file from a text file of 500 x 500 dimensions. Are you required to use some specific programming language? Does any restrictions regarding libraries, packages etc apply? (I guess python may be used)
zak100 Posted March 28, 2020 Author Posted March 28, 2020 (edited) Hi, I have a text file created on notepad. I want to convert it into GIF. I found the following link: Converting text to gif But the problem is that I can't specify the image resolution in the above link. It works great. I tried paint but it does not accept text file. My visio is very old and I am not satisfied with the quality of gif created by this 2003 version. So I am thinking to write my own converter. Is it possible? Quote Are you required to use some specific programming language? Does any restrictions regarding libraries, packages etc apply? Not really, its my personal task. But I want to prefer Python at this point as I am studying this right now. Zulfi. Edited March 28, 2020 by zak100
Sensei Posted March 28, 2020 Posted March 28, 2020 (edited) You can create image dynamically in PHP like it has been presented in this article: https://stackoverflow.com/questions/901201/create-a-dynamic-png-image Parameters for image you provide in URI query string. Edited March 28, 2020 by Sensei
Ghideon Posted March 28, 2020 Posted March 28, 2020 (edited) 18 minutes ago, zak100 said: So I am thinking to write my own converter. Is it possible? Yes. But personally I would not bother. 18 minutes ago, zak100 said: I tried paint but it does not accept text file Why not create a 500x500 pixels picture in Paint and then paste the text using paint's Text tool? If you absolutely have to create a program, can you use something like pillow* and ImageDraw?. Pseudo code, untested: from PIL import Image, ImageDraw image = Image.new('RGB', (500, 500), color = (255, 255, 255)) drawer = ImageDraw.Draw(img) drawer.text((10,10), "Content From TextFile", fill=(255,255,0)) https://pillow.readthedocs.io/en/stable/ Edited March 28, 2020 by Ghideon format 1
Ghideon Posted March 29, 2020 Posted March 29, 2020 1 hour ago, Kartazion said: I found this. How to add text to GIF Your link seems to point to the start of this thread. Was that intentional?
Kartazion Posted March 29, 2020 Posted March 29, 2020 3 hours ago, Ghideon said: Your link seems to point to the start of this thread. Was that intentional? Oops: How to add text to GIF I find quite a few examples with Python Imaging Library (PIL).
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now