Hashing is widely used in ANN searching problems, especially in web image retrieval. An excellent hashing algorithm can help the users to search and retrieve their web images more conveniently, quickly and accurately. In order to conquer several deficiencies of ITQ in image retrieval problems, we use ensemble learning to solve them. An elastic ensemble framework has been proposed to guide the hashing design, and three important principles have been proposed, named high precision, high diversity, and optimal weight prediction. Based on this, we design a novel hashing method called BWLH. In BWLH, first, the local structure information of the original data is extracted to construct the local structure data, thus to improve the similarity-preserve ability of hash bits. Second, a weighted matrix is used to balance the variance of different bits. Third, bagging is exploited to expand diversity in different hash tables. Sufficient experiments show that BWLH can handle image retrieval problems effectively, and perform better than several state-ofthe-art methods at same hash code length on dataset CIFAR-10 and LabelMe. Finally, 'search by image', a web-based use-case scenario of the proposed hashing BWLH is given to detail how the proposed method can be used in a web-based environment.