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)
get size of dynamic image
mas_h
Hi,
Is there any way to know the dimension (width, height) of an image which is read
from a database table of type BLOB. Based in this information I would like to set
the required width and height in the report.
I'm using BIRT 2.2 (because of user requirement, so need to go back in time.. ;-( )
Find more posts tagged with
Comments
mwilliams
Hmmm. I don't know that you'll be able to get that info. I think the info you can grab from BIRT is the height/width you have set for the image element. I don't know that the actual image data can be looked at. I'll take a look using the BLOB image data from the sample database in 2.2.2 and see what I can come up with.
mwilliams
Got this from a colleague. Try it in your image onCreate():<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
importPackage(Packages.javax.imageio);
importPackage(Packages.java.io);
var decodedBytes = this.data;
bais = new ByteArrayInputStream( decodedBytes);
bufimg = ImageIO.read(bais);
this.setHeight(bufimg.getHeight() +"px");
this.setWidth(bufimg.getWidth() +"px");
</pre>
mas_h
Hi Michael,
This piece of code helps me to solve the problem. Thanks a lot!