aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Problem with ImageIO.write Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Problem with ImageIO.write" Watch "Problem with ImageIO.write" New topic
Author

Problem with ImageIO.write

Alejandro Barrero
Ranch Hand

Joined: Aug 01, 2005
Posts: 319
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.


Your help will be greatly appreciated,
Alejandro Barrero
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42289
    
  64
When I run the code, I get an exact replica of the input image *with* the text overlaid.


Ping & DNS - my free Android networking tools app
Alejandro Barrero
Ranch Hand

Joined: Aug 01, 2005
Posts: 319
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
Marshal

Joined: Mar 22, 2005
Posts: 42289
    
  64
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?
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4642
    
    5

Um, how big is Ejemplo.jpg' (in pixels)?


luck, db
There are no new questions, but there may be new answers.
Alejandro Barrero
Ranch Hand

Joined: Aug 01, 2005
Posts: 319
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.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10451
    
    8

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?


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Alejandro Barrero
Ranch Hand

Joined: Aug 01, 2005
Posts: 319
The files are exactly D:\\test.jpg and D:\\Ejemplo.jpg.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with ImageIO.write