Trim transparent pixles

Is there a way to trim a bitmap so that the width and height are not effected by transparent pixels?