Jump to content

Converting a txt file into GIF file

Featured Replies

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.

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?

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)

  • Author

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 by zak100

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?

image.png.30285838f2c35bd4d74ce3da11c5757b.png

 

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 by Ghideon
format

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).

Archived

This topic is now archived and is closed to further replies.

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.