• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Convert Ascii String to Tif file format content

 
Ranch Hand
Posts: 469
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can I do this?
Thanks
Angela
 
Greenhorn
Posts: 1
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ....
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you for the response.

able to wrap the test using org.apache.commons.lang.WordUtils;
as shown below.
 
Deepak Kumar
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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


reply
    Bookmark Topic Watch Topic
  • New Topic