06-20-2024, 08:25 PM | #1 |
Member
Posts: 11
Karma: 10
Join Date: Jul 2012
Device: Kobo
|
Help with simple plugin development
Hi everyone,
I wrote a simple lua plugin for koreader, enabling a "double screen refresh" when reading. This can help with reading color mangas/comics to limit ghosting. But, I would like the plugin to do something only if what is actually displayed is a color image. (At the moment, the "double refresh" is always active, event on text or black and white images). And I don't know how to do that. My color files in cbz archives contains "_color" in their names so I thought instead of analysing the picture pixel by pixel (probably a bad idea on a e-reader), simply checking the name of the image currently displayed would be a "good" way to go, but I have no idea how to get the name of the image displayed in my lua plugin. If someone could help me on this one, it would be very nice Thanks Last edited by libeluratio; 06-20-2024 at 08:27 PM. |
06-22-2024, 05:29 PM | #2 |
cosiñeiro
Posts: 1,325
Karma: 2200073
Join Date: Apr 2014
Device: BQ Cervantes 4
|
So you have CBZs with a mix of BW and color images?
And you want the "double screen refresh" just on color images, right? I'm not sure if it is possible to retrieve the specific asset rendered by the engine. OTOH, it should be easy to just register a couple of actions into the dispatcher to toggle your feature based on the document you're reading. That doesn't fix the issue w/ color vs bw but I can't imagine how that can bother you just on bw pages. |
06-22-2024, 05:46 PM | #3 | |
Member
Posts: 11
Karma: 10
Join Date: Jul 2012
Device: Kobo
|
Quote:
Yes, the idea is to do a double refresh only when the page is color, because it is not needed for bw images (at least on the Inkpad color 3 I'm playing with). A double refresh is good for decreasing/erasing the ghosting on color image, but it is also a bit annoying when reading (takes longer for the page to be ready). So, since it is not needed for bw image, I would like to be able to detect if the current image is color or bw to know if the plugin should do something (double refresh) or no (simple refresh). I did not manage how to get the name of the current image displayed, but I saw that I had access to the picture size with self.view.document:getPageBBox(page). So for the moment, I have a solution that works but is not ideal: When converting my source CBZ to crop and resize image to the Inkpad's resolution, if the image is color, I crop one pixel on the width. And in my plugin, I check the image width: if it is lower than the screen width, then it is a color image, then the plugin do the double refresh. I wish to find a better way to do that, but at least for now it is working |
|
07-14-2024, 06:13 AM | #4 |
Junior Member
Posts: 2
Karma: 10
Join Date: Jul 2024
Device: Kobo Libra 2
|
Hi, I'm quite interested in your plugin. I just sent you a DM too.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Plugin Development | KevinH | Plugins | 546 | 09-29-2024 06:57 PM |
Plugin development documentation | dowobeha | Plugins | 1 | 09-03-2021 03:12 PM |
kodev and plugin development | philips | KOReader | 3 | 05-26-2021 12:59 AM |
Device plugin development | reader42 | Plugins | 10 | 03-29-2010 01:39 PM |