36.37 Transparent Images
20190303 A common requirement when working with graphics files that you want to include in a colourful document or to place on your web page is to convert its background from white to being transparent. Both GIF and PNG images support transparency but JPG does not. With a transparent background an image will often blend nicely with the web page or presentation background colour.
$ convert -transparent white orig.jpg trans.png $ display trans.png
After conversion we will want to display to image to ensure all is as expected.
If the white in the original is not pure, as is often the case, we can
introduce some fuzziness to capture more of the background of the
image as transparent using
$ convert -transparent white -fuzz 15% orig.jpg trans.png $ display trans.png
Your donation will support ongoing availability and give you access to the PDF version of the book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0.