* Optional dithering down to the exact eInk color palette.
Note that, on some devices, FW >= 4.11 will do a much better job of it
than us.
That's true on the H2O, for instance, but not on the Forma, where it
only does so on thumbnails, not on the sleep cover...
When it does, grayscaling is done in sRGB space, and not linear light,
like we do, but that's a much more minor issue, and one where no-one
is actually wrong ;).
Depends on B&W covers to avoid nonsensical results.
* Optional letterboxing of full-screen covers to avoid extra Nickel
processing.
Depends on Keep AR to avoid nonsensical results.
* Optional storage as PNG to avoid JPG wrecking the dithering
Depends on B&W covers to avoid storing stupidly large color PNGs.
* Fix rounding errors when calculating thumbnail sizes:
AR should be a float, and we want to honor the *height* expected by
Nickel when there's potential for rounding mistakes (which is pretty
much always for thumbnails, given that the perfect AR should be 0.75).
Meaning we'll want to round properly before truncating ;).
* Fix thumbnail sizes on the Forma. Apparently, quite a few bits of the
FW behave as if the screen was Aura One sized...
Try to do it right on our end instead of following suit ;).
Unfortunately, full-screen cover processing is slightly broken on
nickel's side right now:
it appears to be treating them as Aura One sized, which incurs an
ugly and unavoidable scaling pass, one way or the other...
c.f., http://www.mobileread.com/forums/showpost.php?p=3025725&postcount=225
and the few pages around it.
Don't bother storing it as a u'' string, then doing nothing with it
other than encoding it to write it to a file.
Also touch up use of open() to close the file via a contextmanager.
- use bytestrings to write raw xml data
- compare bytestream to bytestring when checking formats
- use bytestrings to search inside mobi_html (rebased on master). Since
it starts life as a bytestring it does not need to be reconverted.