Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
reduce only images that are wider than page
Calder
I am trying to show dynamic images in my report. I am iterating through a list of images.
If the image is wider than the page width then I want to scale it to the page width. Otherwise I want to just display it.
How do I do this?
Find more posts tagged with
Comments
Calder
just saw a similar post, and worked out the following code from that:
importPackage(Packages.javax.imageio);
importPackage(Packages.java.io);
var decodedBytes = this.data;
bais = new ByteArrayInputStream( decodedBytes);
bufimg = ImageIO.read(bais);
h=bufimg.getHeight();
w=bufimg.getWidth();
if (w>570)
{h=h*570/w;
w = 570;
};
this.setHeight(h +"px");
this.setWidth(w +"px");