Images

F

freesoft_2000

Hi everyone,

I have a bit of a problem converting a JTextPane to an
image.
I am able to convert the JTextPane to a PNG image but its quality is
really bad. Is there a way that i can convert my JTextPane to a high
quality image.

The type of image format does not matter

Here is what i have so far

Code:
public void export(JComponent Component)
{

File f1 = new File("C:\\Temp.PNG");
Dimension Size5 = Component.getSize();
BufferedImage Image1 = new BufferedImage(Size5.width, Size5.height,
BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = Image1.createGraphics();
g2.setRenderingHint
(RenderingHints.KEY_INTERPOLATION,RenderingHints.VALUE_INTERPOLATION_BICUBIC);
Component.paint(g2);

try
{
ImageIO.write(Image1, "PNG", f1);
}

catch (Exception e)
{
e.printStackTrace();
}

}

I hope someone can help with this problem

Any help is greatly appreciated

Thank You

Yours Sincerely

Richard West
 
Y

Yu SONG

freesoft_2000 said:
Hi everyone,

I have a bit of a problem converting a JTextPane to an
image.
I am able to convert the JTextPane to a PNG image but its quality is
really bad. Is there a way that i can convert my JTextPane to a high
quality image.

The type of image format does not matter

I am not sure what exactly your high quality image refers to.

But try to set more RenderingHint, they may help.

--
Song

/* E-mail.c */
#define User "Yu.Song"
#define At '@'
#define Warwick "warwick.ac.uk"
int main() {
printf("Yu Song's E-mail: %s%c%s", User, At, Warwick);
return 0;}

Further Info. : http://www.dcs.warwick.ac.uk/~esubbn/
_______________________________________________________
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top