Hi Rob,

On Wednesday, June 18, 2003, at 07:04 PM, Rob Ross wrote:
I want to be able to draw a simple square with a given width/height in
pixels, filled with a solid color given by a RGB value, rendered at
150
DPI.


1) create a new image object 2) get the graphics of the object 3) draw my square in my color 4) convert the image into a JPEG with the right parameters (especially the DPI) 5) save it to a file.


Ok I have figured out how to do steps 1-3. But I don't know if I have
to do
something special when I draw into the Graphics2D so that later when I
save
it as a JPEG, I can get my resolution of 150 DPI, which is more than
the
standard ~72 DPI of a screen-drawn image.

So, say I have drawn a 100x100 pixel blue square in my Graphics (at 72
DPI)...how do I turn it into a JPEG at 150 DPI?

I don't have a complete answer for you, but I might be able to point you in the right direction.

You could use the Image I/O api (javax.imageio), which is included in
JDK 1.4+.  It provides reading and writing facilities for images.  This
includes file metadata, like resolution.  It appears that the
plugin-independent metadata model includes resolution in
Dimension/HorizontalPixelSize and Dimension/VerticalPixelSize.

http://java.sun.com/j2se/1.4.1/docs/api/javax/imageio/metadata/package-
summary.html

I've never done this myself, so I can't vouch that it works.  But there
you go.

Rhett

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to