aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes Convert Ascii String  to Tif file format content Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Convert Ascii String  to Tif file format content" Watch "Convert Ascii String  to Tif file format content" New topic
Author

Convert Ascii String to Tif file format content

Angela D'souza
Ranch Hand

Joined: Jan 16, 2002
Posts: 469
How can I do this?
Thanks
Angela
Swapna Mishra
Greenhorn

Joined: Sep 05, 2002
Posts: 1
Tiff is an image type. So, what you would need to do is create an .tif image of the text that you have. Java has a package "jai - Java Advanced Imaging API". You could use that.
I had made a class that creates an image stream of tiff type. You could then create a new file and store the image in it.
Here is the class ....
Deepak Kumar
Ranch Hand

Joined: Nov 05, 2007
Posts: 62
Thanks for this program.

if the string is large as shown below, then in the tiff file the below string should be shown as

hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world
hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world hello world

but only few hello world is written to tiff file.
Also can you please let me know if it is possible to format the string as it is and write to tiff file.




thanks a lot
appreciate your help

Thanks,
Deepak
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 8244
    
  23

Deepak Kumar wrote:if the string is large as shown below, then in the tiff file the below string should be shown as
...
but only few hello world is written to tiff file.

So this is a new requirement. It pays to give us ALL of the information at the start.

Not being an image expert I don't have much else to offer beyond: Why do you need to do this?

Converting text to an image doesn't seem to me like a particularly sensible thing to do, since the resulting image is
likely to be waaay bigger than the original text.

Winston

PS: The lines in your last post are far too long.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42635
    
  65
Converting text to an image doesn't seem to me like a particularly sensible thing to do, since the resulting image is
likely to be waaay bigger than the original text.

Having implemented the email-address-as-an-image display here on this site I beg to differ; size is unlikely to play a role in this. But I do admire Deepak's confidence that someone who hasn't posted here for 11+ years might still be listening to the conversation

These days one shouldn't use JAI, though, (which is obsolete), and no com.sun.* classes. The javax.image.ImageIO class would be helpful instead.
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 8244
    
  23

Ulf Dittmer wrote:But I do admire Deepak's confidence that someone who hasn't posted here for 11+ years might still be listening to the conversation

Dang! I always get caught out by those. Colour me "Doh-h!".

Winston
Deepak Kumar
Ranch Hand

Joined: Nov 05, 2007
Posts: 62
thank you for the response.

able to wrap the test using org.apache.commons.lang.WordUtils;
as shown below.
Deepak Kumar
Ranch Hand

Joined: Nov 05, 2007
Posts: 62
however with the below image code,





am getting the image background color as BLACK and font color as WHITE on windows server 2008 R2 enterprise, Service pack1, 64 bit OS.

and the same code am getting background color as WHITE and font color as BLACK on windows XP professional, version 2002, servcie pack 3, 32 bit.

am just quoting the machine configuyrations, am not sure if that is the probelm in different colors.
can somebody please let me know what could be the issue?

Thanks,
Deepak


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Convert Ascii String to Tif file format content