Stylus writing on boox note


#21

It certainly can be done better, but it works really well for me - maybe because the screen is of a given size, and because of this the strokes are roughly the same size.

Maybe one could apply a gaussian-style filter, with the std depending on the derivative of the curve, so sharp edges would be smoothed less.

I added some example images to the github page, so one can see the rendering differences without running the actual code, which I guess is nontrivial on Windows.

Edit: maybe it is simpler if I add the images here. Output of my tool on top, official Onyx export on the bottom. For higher quality, open the image in a new tab.

render_quality


#22

Smoothing looks great on your examples
Hopefully Onyx will see this,
and implement native solution on NeoReader and notes


#23

I guess part of the difference can be explained by different renderers, too. Seems the Onyx output is done with thicker strokes (about 2 vs 1 pixels), and while Onyx has done anti-aliasing in there, the effect somehow seems to be with stronger contrast (looks more “pixelized”).

That said, even with its simplicity, that filtering method gives surprisingly effective results evening out the curves and occasional one-pixel jitters. The differences between the “p” letters of “outputs”, or the top ‘d’ of “dfm(x)/dx2” (not bothering to lookup and paste the correct symbol for the not-really-d) are quite telling.

However, it seems to shorten the ends? E.g. the d’s of the bottom row dx2 and dxn have their end (or begin, depends on how one writes it) shortened by couple pixels. Without reverse-engineering the code (I’m not familiar with that language), I’d throw a guess for a reason: the averaging is handling the end points somehow incorrectly.

What little I can decipher from the code, it tries to do something (padding extra entries with weighted values) to handle them properly, but, seems it only pads with the same end-point value (weighted), which would lead to small shift towards the next points, i.e. shortening… but would it shorten that much?

Hmm… perhaps padding with a mirror image of the second point (or second last) could give better result? (With my out of the sleeve pseudo-code something like:
bpad = (first - (second-first)*before/2) * before

Leaving it like that, uncleaned, to show the idea; flipping the next point as mirrored on the first point, amplified one quarter of the window size more away, with half window size weight. As if the stroke had started half the window amount of points earlier, going straight, through first to second point. (Similarly for the end point, of course.) Edit: that should keep the length of the ends roughly correct, but can do a little bit of smoothing.


#24

There were multiple reasons. The main is that the pressure is handled differently, and for the last part of the stroke the line was to thin to be visible. The other thing was what you have said: averaging makes the stroke to shorten. So I modified the code to compensate for this. Now it keeps the start and end points unmodified.

The strokes are thicker, but the official renderer renders likes too thick compared to the screen. You can barely read pressure-sensitive strokes when exported to PDF.


#25

Any chance that this will one day become an app for the Onyx e-reader itself, complete with Dropbox sync etc.?


#26

I built a Windows exe out of my renderer. Altough it is still command line, it should work without additional dependencies on Windows.


#27

If you were to develop an actual Android app for Onyx e-readers, complete with syncing options, I think a lot of us would be extremely grateful to you. I love taking notes on my Max 3, but the ugly look of the exported files is already becoming an issue. And I just got the November update (at least some November update) a couple of days ago, and the exported files still look the same. It seems we are going to have to wait a long time for an official solution from Onyx.


#28

Unfortunately I have no capacity for doing that. Making this usable without too much tweaking was already more time than I wanted to spend on it. The main problem with the Android app is that one would still have to do the enable wifi - backup notes to file - disable wifi - load the file into the app thing every single time he/she wants to export, because the databases by default are stored in the private storage of the program and not accessible through the file system. Doing it properly would require a rooted Android, so one can access all the files on /data partition.


#29

That is completely understandable, of course. Thank you for taking your time to develop the Python package. :slight_smile:


#30

Hi, xdever!
Can you tell me if it is possible to apply the program you posted to GitHub for a single pdf file (for example a note made with Onyx or another eink device) or for multiple pdf files concatenated in a .zip file?


#31

Hi rafali,

You cannot apply it to a pdf file. You can only apply it to a backup .zip file exported by the note app. It works only for notes, not for PDF annotations - I don’t know how to get out the raw note files from the pdf reader app. Maybe another app that applies moothing directly to PDF annotations could do that.


#32

sorry, do you know, can notes be backed up without a cloud connection? In previous versions of the software they had the possibility of a local backup. Now I haven’t seen this possibility.


#33

Yes, you can. Instructions from the github page:

“Turn on the WiFi on your device (because of the bug in the reader that doesn’t let you to create a backup of notes without WiFi enabled), go to the note app, select the three-line-menu from the top, Backup and Recover, select the floppy disc icon, choose a filename, click ok. Wait until the notes are exported. Connect the device to your computer, and copy over the zip file generated. It is in folder note/backup/local/.zip. Copy that over to the computer, and run this tool on it.”


#34

After I created an Onyx account, I was able to make a local backup, but running the program onyx_render.py I get an error (I took a screenshot). The backup is called “fisiere.zip” and is placed in C: \ users \ user \ Desktop.


Can you guide me a little more?
Thanks!


#35

Dear rafail,

It needs python3, won’t work with python2. You will also need pycairo which is tricky under Windows. The easiest way to get it is from here I guess: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pycairo.

Once you installed that manually, (pip install whatever.whl), you could install the rest of the requirements with pip install -r requirements.txt.

You could also try the exe file in the releases which should not need any dependencies (https://github.com/xdever/OnyxNoteRenderer/releases/download/v0.2/onyx_render.exe).

Sorry guys, I know that a lot of you uses Windows, but I have no clue how to make python run on it. Nor I have access to any Windows machines. My only experience with it is what I gained while tried to build that exe file above.


#36

There is a relatively easy way to run this code under Windows10: use Linux Subsystem for Linux (https://docs.microsoft.com/en-us/windows/wsl/install-win10), install an ubuntu system. In that one can easily install all the prereq of this code:
$ sudo apt install python3 python3-numpy python3-cairo python3-tqdm
after that you can run by:
python3 onyx_render.py your_backup.zip your_out_dir


#37

Gubi debugged the code on Windows. Now the exe file should work along with the older note files (without WSL).

Quick link: https://github.com/xdever/OnyxNoteRenderer/releases/download/v0.2/onyx_render.exe


#38

Instaled python 3.8, updated pip to 19.x.x, instaled python accesories pycairo, numpy, tqdm, and…
Succeeded!
The notes are looking excellent!
Great job, xdever!
Thanks a lot!


#39

so i have a brand new note 2, firmware date 6th Nov '19, it has the auto refresh feature, but my notes are jagged and zoomed in on a PDF looks pretty bad. Is it just going to stay that way or will Onyx fix this? For me it’s pretty much “send back the device” if this doesn’t get fixed. it’s flippin pricey to look this bad.


#41

I just added a new tool for smoothing PDF annotations. For now only works with non pressure-sensitive annotations and there is no exe yet, but coming soon(ish).

For more details, check the instructions at the Github page.