Re: How to trim the transparent pixels from the image border?
Posted: 2008-04-22T20:27:49-07:00
This seems to work for me:
Create image with transparent border:
convert -size 100x100 xc:white white.png
convert white.png -bordercolor none -border 50x50 test.png
identify test.png
test.png PNG 200x200 200x200+0+0 DirectClass 16-bit 784b
Trim border:
convert test.png -trim +repage test2.png
identify test2.png
test2.png PNG 100x100 100x100+0+0 DirectClass 16-bit 494b
Create image with transparent border:
convert -size 100x100 xc:white white.png
convert white.png -bordercolor none -border 50x50 test.png
identify test.png
test.png PNG 200x200 200x200+0+0 DirectClass 16-bit 784b
Trim border:
convert test.png -trim +repage test2.png
identify test2.png
test2.png PNG 100x100 100x100+0+0 DirectClass 16-bit 494b