This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Save Component(containing jpeg and JLabels) as JPEG?  Is there a package for this? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Save Component(containing jpeg and JLabels) as JPEG?  Is there a package for this?" Watch "Save Component(containing jpeg and JLabels) as JPEG?  Is there a package for this?" New topic
Author

Save Component(containing jpeg and JLabels) as JPEG? Is there a package for this?

Matt Wilcko
Ranch Hand

Joined: Sep 23, 2003
Posts: 65
Is it possible to save a Component(containing jpeg and JLabels) as a JPEG? Has anyone seen a package out there that allows this by simply passing the component?
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8836
    
    7

Given a Component "this", one can create an image and write it to file by:


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Matt Wilcko
Ranch Hand

Joined: Sep 23, 2003
Posts: 65
Thanks Joe!
One more question, any idea if I can specify dpi? Ideally the image would be 300 dpi for high quality printing.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8836
    
    7

Why didn't you just post a new topic with a link to your
previous question
Brian Pipa
Ranch Hand

Joined: Sep 29, 2003
Posts: 299
I tied this a few years ago and could find NO way to get anything more than 72 DPI. I was using an image then using a PDF converison library to convert it to PDF. The output looked awful because it was 72 DPI. I gave up on the PDF/JPEG output. If anyone does know a way to make it greater than 72 DPI, I would be interested to hear it also.
brian


My Java Freeware:<br />MACCC - <a href="http://maccc.pipasoft.com" target="_blank" rel="nofollow">http://maccc.pipasoft.com</a><br />Nator - <a href="http://nator.pipasoft.com" target="_blank" rel="nofollow">http://nator.pipasoft.com</a>
Matt Wilcko
Ranch Hand

Joined: Sep 23, 2003
Posts: 65
Would it be possible to create a component that is larger than screen size(2000 x 1500 for example) and then make a jpeg from that with the method above?
It wouldnt be 300 dpi, but an image that large could be converted to a 6.5" x 3" 300 dpi image. Basically the same as a digital camera, a high rez 72 dpi image.
Just have the user work on a low rez version on-screen and then from that create the very large component and save it to jpeg.
Will this even work? Im just thinking out loud.
 
 
subject: Save Component(containing jpeg and JLabels) as JPEG? Is there a package for this?
 
Similar Threads
PDF to Image Converter
B&S: Can we include Images in javadoc HTML documents?
Java Code to Convert RTF to JPG
How to create an image in Rational Rose ??
Can you specify a jpeg's dots-per-inch when saving a component as jpeg?