View Single Post
Old 12-28-2011, 03:28 AM   #1
rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.
Posts: 2,272
Karma: 8570000
Join Date: Oct 2010
Location: Vancouver, BC, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623, PB 840
A homebrewed program for viewing image archives (cbz, cbr,...)

pbimageviewer is a program for viewing collections of images. The images can be collected within a directory, or within archives such as CBZ/ZIP, CBR/RAR, CB7 and CBT/TAR files. Images can be zoomed/unzoomed, and navigation over the images can be done with the buttons and/or the stylus. For people without touchscreens, full navigation is available via the buttons. For cartoons/manga, the program can automatically detect separated panels, fit each panel to the screen if desired, and jump between panels using the buttons. As a non-touchscreen owner myself, I was motivated to make the experience easier for those of us relying on buttons.

CBZ, CBR, CB7 and CBT files are unpacked within the program, and no external programs are required. Note that for CB7 and CBT files, you have to go to the website and also download the correct version of the file and install it to the system/bin directory. CB7 handling is very slow, though, so it's recommended that you convert them to one of the other supported formats instead.

To use the program, download the correct version for your device from the links at the bottom of this post. The 3XX version is for the older 301, 302 and 360 models. The fwv5 version is for the latest devices with firmware version 5 installed (check Settings>Software>Software_Version). The Pro-360+ version is for all the rest of the PocketBook models that were released in between with firmware version numbers between 2 and 4. Note that some models can have either firmware version 4 or 5 installed, so check the settings if you're not sure which it is.

Unless you have an old device, you should also download the file and unpack it into the internal memory.

To use the program to view archives, you just need to unzip and copy the provided pbimageviewer-***.app file to system/bin/ on the device, and then edit the system/config/extensions.cfg file to make the system recognize the archive files as books. After that, you should be able to open .cbz or .cbr files in the library app.

The following is what I added to my extensions.cfg file (note that the name of the app on each line should match with the name of the file it was copied to in the system/bin directory):

N.B. I can't seem to open .zip files because it looks like the Library application won't allow it. The simple fix is to change the file extension from .zip to .cbz on the archive files.

If you want to read CB7 and CBT files, add the following to the config file (and install the library as described above):


You can add the following to make the default image viewing application for the Photo/Gallery application. Just add the following to the extensions.cfg file:


You can also copy the file to applications/ and then use it via the Applications tab to look at already existing image folders.

Finally, older devices have their capabilities hard-coded into the program, but with new devices coming out steadily, the program was modified to accept configuration files for new models. This way, a new device can be made to work without needing a new version of the application to be built. If you have a recent device, then download device_capabilities/ and unzip it into the internal memory. It will copy device configuration files for newer devices to the system/share/pbiv/ directory. If you have a device for which there is no configuration file, then create a new one based on the README.TXT and default.cfg files in the zip archive. The new configuration file should be named using the model number of the device. For example, the configuration file for the Inkpad 840 is named 840.cfg.


Here is part of the announcement for the first release, for historical purposes:

I had been grumbling about needing to convert manga and comics to PDF or EPUB for reading on my 902, and finally decided to do something about it. I found a nice image viewing program written by Michail Polubisok (aka Dirondin) that could be used to view images in a directory. I added code to automatically unpack archives of images (in ZIP, RAR and TAR formats), and then since these archives were like books, I added many Inkview book features to the software as well (like Table of Contents and Page Selector for navigation, changing orientation, saving state and configuration options,...). The unpacking of archives is rather crude (it relies on the external programs unzip, unrar and tar), but for a first version, I find the program to be very useable even at this stage.

I've contacted Michail to help improve it, however he is very busy with schoolwork and a job right now, so I've decided to release the program as is and get some feedback on its useability before working on improvements to the archive handling code.

There is currently no support for a touchscreen, mostly because I don't have one. However, I'm sure the stylus would be very handy for panning zoomed-in images, and I expect it'll be added later if someone with a touch device wants to help with that. I've also written the menus to be internationalizable, so if anyone wants to help provide translations for other languages, they would be more than welcome.

I've put together a zip file with the necessary programs for both the newer Pro (and 360+) devices and for the older 30X/360 devices, as well. The latter are completely untested by me and may not even work, but I live in hope. I'll provide a link to the source code and unrar/unzip packages when I have that ready sometime soon.


Edit: Sorry, the first version of the Pro zip file had a version of unrar that wouldn't work on the devices. I re-uploaded the zip with a working version.

Edit 2: Uploaded new versions with some bug fixes.

Edit 3: Added custom zoom level feature requested by @dtanis.

Edit 4: Added configuration item to force unpacking of archives into /tmp rather than the directory that the archive file is in. This is useful if unpacking into the FAT directories fails for some reason (like non-ASCII characters in image filenames).

Edit 5: Added popup dictionary. Also switched from using the external unzip and unrar programs to using libzip and libunrar. So, unrar and unzip aren't provided in the zip file anymore. The program starts up and shuts down much faster now since each image is unpacked as needed (rather than all the images at once in the beginning), it takes up much less file space when running, and all images are temporarily unpacked to /tmp so that odd characters in filenames shouldn't be a problem anymore.

Edit 6: Added support for BMP and GIF images. Thanks to a lot of testing and excellent suggestions by @dtanis, I've been able to add support for using the stylus to control the program. You can pop up the main menu by tapping, pan the image and change pages by swiping with the stylus, and set the custom zoom by dragging across the part of the image you want to zoom in on. Horizontal panning was disabled in custom zoom mode so that swiping and left/right button pushes could be used to change pages then. This is pretty much everything I wanted to add to the program, so I don't expect many more features to go in after this. Still, suggestions and bug reports are always welcome. (Sorry, original uploads had a bug when decoding some GIFs, so a fixed version has been uploaded)

Edit 7: Added a menu item for rotating the screen if the global setting isn't set to automatic (for @fsvum). If it is set to automatic, then the program just behaves as before. So, there is no need to re-download and install if you use automatic orientation all the time.

Edit 8: Added support for (single image) TIFF files. Fixed a memory leak while decompressing RAR files.

Edit 9: Added menu and configuration options for enabling/disabling the status bar at the bottom of the display (for @vomov).

Edit 10: Added icons to the global configuration menu to make the text readable. Also added cartoon panel detection and navigation, so that those without a touchscreen could more easily read cartoons and manga.

Edit 11: Fixed handling of RGB data from PNG images when detecting cartoon panels.

Edit 12: Fixed rotation menu items, and the saving of state when the program was backgrounded. Also, added the option of automatically enlarging each cartoon panel to fit within the display. Thanks to PascalV for the bug reports and the suggestion.

Edit 13: Updated the beginning of this post to better reflect how the program now works (instead of how it worked on the first release).

Edit 14: Fixed the broken touch functionality, configuration page, and added zoom by pinching, all for the Touch 622. Thanks to luigibrosse, DmitryZ and seiichiro018 for helping me with that. Changed zooming to try to keep the same point at the center of the image.

Edit 15: Added support for zip and rar archives encrypted by a simple password. Added French, Portuguese and German translations (thanks to PascalV and seiichiro018). The step size percentage can now be configured to give 611 users a little more control (thanks to Klapo). The current image can now be saved to a configurable directory via the main menu.

Edit 16: Added the ability to automatically start the next archive in the directory, and also to automatically restart archives at the beginning if they were exited on the last page previously. Both features need to be enabled in the configuration page, as they are off by default. @dtanis has also supplied a full Dutch translation, and a partial Japanese translation (to be finished later), and PascalV and seiichiro018 have updated the French, Portuguese and German translations for the new features.

Edit 17: The last update had a broken configuration on the Touch. A fixed version was uploaded. The version for the older 3XX devices wasn't changed.

Edit 18: Added automatic startup after booting. Improved sorting of filenames in archives. Check magic number of RAR and ZIP files in case they are named incorrectly. Instantly apply Auto Panel Mode to current page, plus show icons in the bottom panel to indicate when the mode is on (as well as when auto resizing of panels is on). Added Brightness/Contrast/Gamma controls. Changed Next/Prev buttons on the Touch to step between panels in that mode, or just step the pages up and down otherwise. Added global configuration item for setting the screen orientation at startup (unless Automatic Orientation is enabled on the device). Added translations from dtanis, PascalV and seiichiro018.

Edit 19: Fixed a bug where the app crashed when launched from the Applications tab. Thanks to Dungeone for pointing it out.

Edit 20: Added the Touch Lux to the list of devices that use the new configuration structure. Thanks to seiichiro0185 for the patch.

Edit 21: No new features, but made the app work better on the newer touch devices. Colour images should be visible on the Colour Lux. Tailored the Help page to only show info on buttons that the current device has. Debug logging can now be enabled/disabled in the configuration.

Edit 22: Added automatic checking of file magic numbers for opened directories and CBZ files. Checking inside CBR files is slow, so it has been added as a configuration option. Added the ability to define the device capabilities via a configuration file, so new devices can be supported without requiring the source code to be updated. This should fix the crashes seen on the latest devices. People with 614, 624 and 626 model devices should download the file and unpack it into their internal memory so that the new XXX.cfg files end up inside the system/share/pbiv/ directory. The zip file will be updated as new models emerge in the future. There is a brand new Hungarian translation produced by @gyeben, so many thanks to him for that!

Edit 23: Fixed a bug for the Colour Lux where new archives always started out as black and white rather than colour. People with other models don't need to update if they did so recently.

Edit 24: Fixed the problem that munenori had with the missing rotation menu. This only applies to new devices without a g-sensor, and maybe only the 611 with new firmware.

Edit 25: Added config files for the Aqua (640) and the Ultra (650).

Edit 26: Version 1.0! Broke up the menus on new devices. Added two more two-fingered gestures for multi-touch devices, and descriptions for them in the Help dialog. Added margin cropping and faster navigation in cartoon panel mode for all devices. All translations except for Hungarian have been updated. Fixed the bug to do with the configured step size.

Edit 27: Added a version for devices with firmware version 5. It has the necessary libjpeg and libtiff functions statically linked, so it is bigger than the versions for the other devices.

Edit 28: Added a config file for the 840 Inkpad.

Edit 29: Added tap zones like in the PocketBook reading applications. Added a configuration option to automatically rotate images based on their aspect ratio. Added a Contents menu item for the Inkpad, since it doesn't have a menu button. Inkpad users should also download and install the latest 840.cfg file from the file for that to work. Fixed (I hope) the problem with corrupted images on the Inkpad running firmware version 5. Worked around some buggy multi-touch operations on the Inkpad (fwv 4.4.1073). This new version is labelled "1.1".

Edit 30: Version 1.1.1. Fixed a bug in the autodetection of archives based on magic numbers. Thanks to starr974 for pointing out the problem.

Edit 31: Version 1.2.0. Added support for 7z archives (the proper file needs to be downloaded from the website and also installed at /system/bin). Can now use the application to view images on the device via the Photo application. Fixed multi-touch event handling on the latest firmware versions (>=5.4). Added the ability to set the reading direction (left-to-right or right-to-left), and made the Next/Prev buttons go Forward/Backward according to the reading direction. Changed the two-fingered tap gesture to "unzoom" the image rather than open the second menu.

Edit 32: Version 1.2.1. Added a Configuration item for automatically setting the reading direction on newly opened books (the default is left-to-right). Save the reading direction in the settings file for each archive.

Edit 33: Version 1.2.2 Updated the translations for the latest features, and added a new Polish translation by @freeshadow! Added a config file for the 630 (Sense). Otherwise, no new features.

Edit 34: Version 1.2.3 Changed the "Go to page" dialog to work on newer devices. There is no change for devices on firmware version 2 or older.

Edit 35: Version 1.2.4 Updated to a new version of libunrar, and overrode the conversion of wide char file names in RAR files.

Edit 36: Version 1.2.5 Added a new Bulgarian translation by @AdmiralAnime! Added a new zoom mode for double-page scans. Made stepping jump to the opposite side of the page as well as going up or down when reaching a side. Changed the Custom Zoom mode to allow panning anywhere on the page.

Edit 37: Version 1.2.6 Added a page info dialog that is invoked by pressing the bottom middle tap zone. Version 5 firmware devices no longer have that information showing in the status bar, so it is mostly for them. Older devices without a touch screen will have to depend on the status bar for that information. I've also added a configuration file for the Touch HD (631) to the file.

Edit 38: Version 1.2.7 Store the first image as the book cover (to be displayed when the device shuts down). Added the option to disable touch navigation. Truncate the old log file on start up to save space. Made devices set up for left-handed use autorotate to portrait 180 if desired. Added @brucelee's cmake tools to allow building under his SDK. Added top-middle tap zone for bringing up the light-level dialog if supported.

The source code and binaries are also available at: A debug version of for the latest devices is also available at the website, and can be used with gdb and pbterm to debug crashes.
Attached Files
File Type: zip (4.7 KB, 124 views)
File Type: zip (187.7 KB, 86 views)
File Type: zip (197.5 KB, 54 views)
File Type: zip (245.4 KB, 38 views)

Last edited by rkomar; 11-06-2016 at 04:17 PM.
rkomar is offline   Reply With Quote