Crop image to smallest size by removing transparent pixels in java

后端 未结 6 964
走了就别回头了
走了就别回头了 2021-01-21 15:04

I have a sprite sheet which has each image centered in a 32x32 cell. The actual images are not 32x32, but slightly smaller. What I\'d like to do is take a cell and crop the tr

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-21 15:54

    I think this is exactly what you should do, loop through the array of pixels, check for alpha and then discard. Although when you for example would have a star shape it will not resize the image to be smaller be aware of this.

提交回复
热议问题