Step 3: Inkscape
When you open Inkscape, you should be greeted with a blank screen. Press File - Open. Go to where you saved your LibreOffice Math PDF files, and open the first one:
You will be greeted with this screen. Just press Ok:
You can now see the PDF that LibreOffice created open in Inkscape.
Now you have to click on the formula, and arrows should appear around it:
Side Note: IF you are greeted with the entire thing surrounded by arrows. Press Object - Ungroup. This should split it into clickable sections. It should now be possible to press on the formula.
Make sure just the formula is selected and has arrows around it, and press File - Export Bitmap...
The Export Bitmap dialog should pop up. This is where you Inkscape what resolution the final PNG will be, and where to save the PNG.
IMPORTANT: Make sure along the top, that the "Selection" button is chosen. Selection means it will create a PNG of everything that is inside the "surrounding arrows".
Personally, I have settled on "320" as a good DPI for formulas. This determines how large the letters/numbers will be in the final PNG (and thus, the EPUB). Feel free to raise/lower this to suit your liking.
You can also manually tell Inkscape which X/Y resolution you want created by changing the "Width" and "Height".
Side Note: I recommend keeping the DPI the same throughout an entire book, so when formula PNGs are scaled to their max width, they will all have the same size font.
After setting the DPI (or Width/Height), press Export. This will now save the file to the location you selected.
Side Note: Inkscape auto-names the file g#####.png. This is quite annoying. Make sure you change to a better filename so you can keep the images organized.
Repeat Step 3 for all formulas until you have 320 DPI PNGs generated for all Formulas.
Step 4: GIMP
Open GIMP, and open the PNG formulas created from Inkscape.
Press Layer - Transparency - Remove Alpha Channel:
This should result in the transparent background turning white:
Since there is no color in this image, you want to change the mode from RGB to Grayscale.
Note: Going from RGB (nearly every color under the sun) to Grayscale will cut down the filesize DRAMATICALLY. "Grayscale" means it will be 256 shades of gray.
Press Image - Mode - Grayscale.
Now we have to save the PNG again. Press File - Export...
Choose where you save your file and what to name it.
IMPORTANT: Make sure that ".png" is at the end of the filename. This will tell GIMP to Export this as a PNG.
Uncheck all the boxes in the dialog box, and make sure Compression is set to max. Press Export.
Repeat Step 4 for all Formulas.
Step 5: Insert into the EPUB
That is all! Now you can insert the PNG into the EPUB just like you would any other image.
I have attached a sample EPUB full of the real world text, with two XHTML files: "Old" and "New". The "Old" has PNG snapshots taken from the PDF, while "New" has the new PNGs generated by this tutorial.
Feel free to compare them both for yourself.
Side Note: I have left an Extra Credit image (the formula at the top of Page 182: See Step -1). See if you can generate a new and improved version using the Tutorial above!
If you need a hint with the Libre Math "code" for the Extra Credit: