Skip to content

Added read/write support for image blobs#52

Open
yannickulrich wants to merge 3 commits into
ricklupton:mainfrom
yannickulrich:images
Open

Added read/write support for image blobs#52
yannickulrich wants to merge 3 commits into
ricklupton:mainfrom
yannickulrich:images

Conversation

@yannickulrich
Copy link
Copy Markdown

This adds support for the native image insertions in notebooks on 3.27 or later. It is similar to PR #51 but parses the whole object rather than just the filename. The construction is based on remarkable-shapes which already has this ability in ruby.

On the top-level, images are defined in a SceneImageInfoBlock (SceneAssetBlock in #51, block type 0x0E) via a UUID. They can have a flag which currently always evaluates to [17, 0]. They are then references in the tree as a SceneImageItemBlock (ScenePathItemBlock in #51, block type 0x0F, item type 0x07). This uses the UUID defined earlier and includes image placement as a list of image vertices (x, y, u, v tuples)

[
  left, top, 0.0, 0.0,
  right, top, 1.0, 0.0,
  right, bottom, 1.0, 1.0,
  left, bottom, 0.0, 1.0
]

I have so far made no attempt at parsing this further since it should probably be done by rmc instead. The image block also contains a magic sequence of integers.

I have verified that this can read and write files generated by the remarkable and the remarkable-shapes library but haven't added any pytests yet.

Side note: I've also added a read_lww_bytes function for the image flag and the UUID when referenced in the SceneImageItemBlock. There's probably a better way of doing this but I couldn't find one quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant