block.width = img.getWidth(null); block.height = img.getHeight(null);
if(img != null) { block.width = img.getWidth(null); block.height = img.getHeight(null); } else { block.width = 50; block.height = 50; }
    public Box layout(Context c, Element elem) {        BlockBox block = (BlockBox)createBox(c,elem);        // load the image                Border border = getBorder(c, block);        Border padding = getPadding(c, block);        Border margin = getMargin(c, block);                Image img = getImage(c,elem);        // calculate new contents        block.width = img.getWidth(null);        block.height = img.getHeight(null);        //Rectangle contents = new Rectangle(0,0,img.getWidth(null),img.getHeight(null));                /*        block.width = this.getMargin(c,elem).left + this.getBorder(c,elem).left + this.getPadding(c,elem).left +            block.width +            this.getMargin(c,elem).right + this.getBorder(c,elem).right + this.getPadding(c,elem).right;        block.height = this.getMargin(c,elem).top + this.getBorder(c,elem).top + this.getPadding(c,elem).top +            block.height +            this.getMargin(c,elem).bottom + this.getBorder(c,elem).bottom + this.getPadding(c,elem).bottom;        */        // calculate the inner width        block.width = margin.left + border.left + padding.left + block.width +                padding.right + border.right + margin.right;        block.height = margin.top + border.top + padding.top + block.height +                padding.bottom + border.bottom + margin.bottom;        // create the new block box        //block = new BlockBox();        block.x = c.getExtents().x;        block.y = c.getExtents().y;        //block.width = contents.width;        //block.height = contents.height;        return block;    }