cancel
Showing results for 
Search instead for 
Did you mean: 

BufferedImage

Former Member
0 Kudos

Is there any way to use BufferedImage in Dynpro applications. I am trying to get a image using BufferedImage by passing the URL of a image file existing as a KM doc on the portal. I want to know the height and width of the Image coming in. Anyway this can be done?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Armin,

Thanks for your reply. What do you think is going to happen if the URL is not existent. I have tried this method and it doesnt seem that any width is returned even if the image can be found in the portal.

regards,

Deepak

Former Member
0 Kudos

Can you post your code?

Armin

Former Member
0 Kudos

Hi Armin,

The problem actually stems from the fact that I am using in my dynpros certain Image URLS that exist on a KM folder on the portal.

Now I did not see a way to confirm that the URL actually exists before I use it. So I thought that BufferedImage might let me actually know whether the URL exists or not. The problem that occurred then was that my code throws an exception that InputStream could not be found.

I gave up on that method but have been wondering if BufferedImage might let me have pixel width and height. Now we have the method that you have mentioned, however I am using NW2004 and not 2004s.

Former Member
0 Kudos

An easy way to load an image from an URL and get its size is:


java.net.URL url = new java.net.URL("<wherever>");
javax.swing.ImageIcon image = new javax.swing.ImageIcon(url);
int w = image.getIconWidth();
int h = image.getIconHeight();

Armin

Former Member
0 Kudos

What exactly do you want to achieve?

In NW04s, there is a new boolean property "adjustImageSize". If this property is set to true, the image size is adjusted proportionally to avoid distortion.

Is this your goal?

Armin