Top.Mail.Ru
January 29th, 2007 - Java developers — LiveJournal
? ?

Java developers

January 29th, 2007
Image

06:02 pm - Imageshamansoft - image processing

Help!
I need to decrease the image size, but I should save its resolution.
i.e. there is an image 2448x3264 pixels, resolution 300dpi, I should get the similar image 260x343pixels and 300dpi.
I tried to use this part of code:
BufferedImage original = decoder.decodeAsBufferedImage();
Image scaledImage = original.getScaledInstance( 260, 343, BufferedImage.SCALE_AREA_AVERAGING );
BufferedImage result =new BufferedImage( 260, 343, BufferedImage.TYPE_INT_RGB );

It decrease the size, but it changes the resolution to 96dpi.
So the main problem is to set up the picture's resolution to 300dpi. Have you any ideas?
Image

09:58 pm - Imageska_o - JScrollPane question

Is there a simple way to configure JScrollPane so that it forces the horizontal size of its parent on its contents? I need to scroll only vertically and display the full width.

Update: I figured it out. The child component (viewport view) needs to implement the interface Scrollable, whose method getScrollableTracksViewportWidth() needs always to return true.
Powered by LiveJournal.com
Image