• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

Problem with ImageIO.write

 
Ranch Hand
Posts: 502
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to load an image from a JPG file draw some text with a program and create a file with the image and the text. This is my test class:

The file test.jpg contains the same image as Ejemplo.jpg but it doesn't show the text. I haven't been able to find out what is wrong or what else should be done.
 
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I run the code, I get an exact replica of the input image *with* the text overlaid.
 
Alejandro Barrero
Ranch Hand
Posts: 502
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I jared the program and still no text. the question then is what is wrong with my environment? I am using MyEclipse 8.6.1 and Java 1.6 in a Windows computer.
 
Ulf Dittmer
Rancher
Posts: 43028
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does it still happen if you delete the output file first and close whatever program you're using to view it, or -even better- create an output file with a different name?
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Um, how big is Ejemplo.jpg' (in pixels)?
 
Alejandro Barrero
Ranch Hand
Posts: 502
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ulf for your support. I just used a new, in-existing file, with the jar file and got the same results. I was viewing the file with Picassa as windows default and closing it every time. Latest I opened the file with Windows Paint. It appear drawing to the graphics is not working in my computer, but I tested it. When I type and display in a JPanel; drawing text in paintComponent() displays the text in the window. However printing the Jpanel with the text that displays in the window doesn't show the text, although printing with paint() should be using paintComponent(). I use

I am mystified.
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

D:\\test.jpg
D:\\Ejemplo.jpg


How are the files name on your disk. Do they end in upper case JPG or jpeg by any chance?
 
Alejandro Barrero
Ranch Hand
Posts: 502
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The files are exactly D:\\test.jpg and D:\\Ejemplo.jpg.
 
reply
    Bookmark Topic Watch Topic
  • New Topic