Yes, you can use imagemagic to do this from the command line.
convert image.png -background white -alpha remove -alpha off white.png
Feel free to replace white with any other color you want. Imagemagick documentation says this about the -alpha remove operation:
This operation is simple and fast, and does the job without needing any extra memory use, or other side effects that may be associated with alternative transparency removal techniques. It is thus the preferred way of removing image transparency.
A bit more searching tells me that:
identify -format ‘%[channels]’ foo.png
will print rgba or rgb if there is or is not an alpha channel, respectively.
There could be an alpha channel present with no data in it which wouldn’t actually have any transparency, but that is a bit more complicated.
If I just want to know if there is a transparent pixel in an image
identify -format ‘%[opaque]’ a.png
If you have a document and you want me to test a process on it, let me know.
Although transparency in images appears to cause no problems in PDFs created by LO, in fact it sometimes interferes with printing on some of the equipment used by Lulu to produce printed copies of our books. When this happens, Lulu removes the book from availability until the problem file is fixed.
The recommended fix is to “flatten” the PDF. I have not found any way to do this during PDF creation using LO. It can be done using Adobe Acrobat Pro, which I do not have.
Another solution could be to flatten (remove the transparency) the problem images, but our books contain a lot of screenshots and other images and I don’t know an easy way to identify all of the problem images, nor do I know how to flatten them.
If anyone knows a way to overcome this problem, please let me know. I would prefer to not pay for, or use, Acrobat Pro.