readium / go-toolkit

A toolkit for ebooks, audiobooks and comics written in Go
https://readium.org/web
BSD 3-Clause "New" or "Revised" License
41 stars 14 forks source link

Images are missing `height` `width` #50

Closed jccr closed 6 months ago

jccr commented 4 years ago

I noticed this change when comparing outputs of the Go streamer and the JS streamer. Screen Shot 2020-03-18 at 6 15 22 AM

HadrienGardeur commented 4 years ago

There's a cost in doing that though. If we add this as a feature, we need to make sure that it can be turned off as well.

danielweck commented 4 years ago

I have not measured the runtime costs empirically, but there sure is an impact when parsing (for example) an EPUB, and when every image resource is accessed to determine the width + height. In the Node / JavaScript implementation (TypeScript) this job is blocking (waiting on an async promise), and the job is delegated to an external library that knows how to parse image file headers. The filesystem I/O is minimal in terms of the number of bytes accessed, but opening/closing many file handles is not completely free :)

jccr commented 4 years ago

Ah yes.. I remember that blocking job very well :) Thanks, both of you, for the reminder about the cost of calculating this.