最好的办法是使用一个纯废墟图书馆,例如http://docs.seattlerb.org/png/,来自西雅图.rb或。
It s quite easy to follow. You should create a white 200x200 canvas and load your image onto it, or if you find it easier, compose images using alpha blending.
(以uck为例):
# Compose images using alpha blending.
avatar = ChunkyPNG::Image.from_file( avatar.png )
badge = ChunkyPNG::Image.from_file( no_ie_badge.png )
avatar.compose!(badge, 10, 10)
avatar.save( composited.png , :fast_rgba) # Force the fast saving routine.
如果你真的需要一种新的形象,而仅仅为了展示主人,使用 c和(或) j,就会更加容易。