Meaningless Drivel is fun!*
The moose likes Swing / AWT / SWT and the fly likes how to save text as gif ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to save text as gif ?" Watch "how to save text as gif ?" New topic
Author

how to save text as gif ?

jite eghagha
Ranch Hand

Joined: Oct 06, 2006
Posts: 127
hi,

How could i save text i typed into a textArea as a gif.

Fisrt:
Imagine your typed up a report and saved it as a text file (.txt)
or you wrote and saved a java file (.java)

Now:
Imagine you wanted to open this file?
I want to view my file as a thumb gif and scroll into it, as the image gets big enough, it the reverts back to a (.txt file)

How can i capture the text image?
what option is more do-able:
1. capture the image when it is in a text area.(how do i do this)
2. convert the .txt file to a gif.(is this possible)
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

Look in javax.imageio.*. You can capture your UI as an image and then store in formats like gif or png.


Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
So you actually don't want to create a gif, but you want have it painted at a screen at a different "zoom level"?

So wouldn't it suffice to paint the text area on the screen using a Graphics object with an appropriate AffineTransformation applied?

Moving to our Swing forum...


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
jite eghagha
Ranch Hand

Joined: Oct 06, 2006
Posts: 127
thanks,

i'll work on those thoughts.
David Wheeler
Greenhorn

Joined: Oct 07, 2005
Posts: 6
Not really Swing, but I created a command line app to convert a text file into multiple .jpg (or .gif) for viewing on a Sony PSP. A cludged eBook reader :

Scott Florez
Ranch Hand

Joined: Dec 05, 2006
Posts: 58
Here's some basic code I have used for option 1:


[ December 11, 2006: Message edited by: Scott Florez ]
 
jQuery in Action, 2nd edition
 
subject: how to save text as gif ?
 
Similar Threads
sequence diagram with rational rose
capture image
pls help ....writing image to file
About printing and reading
Any idea capturing mouse cursor with Robot