Jeroen Walter

Jan 142014
 

ImageViewer

(this article is a backup of the old, deleted wiki page)

IOS Resource Restrictions

IOS 5 limitations:

Problem: Maximum image size: 5 Megapixels (5 * 1024 * 1024)

Example size: 2048×2560

This holds for HTML IMG elements and DIV backgrounds.

IOS Stupidity: If you directly type the url of a jpeg in the address bar, the size can be much larger.

Solution: Resize images larger than 5 MP to 5 MP.
Alternative solution: split the image into 4 separate images, one for each quadrant. This means a rewrite of the ImageViewer component, so won’t be done any time soon.

Notes IOS 6 is supposed to have larger limits.
I have no idea what the limits are for Android tablets.

Problem: Maximum image size of baseline jpeg file, before jpeg sub-sampling kicks in: 2 Megapixels.
Solution: Use progressive jpeg to prevent sub-sampling.

Problem: GDI+ doesn’t support saving to progressive jpeg.
Solution: Use FreeImage.NET library freeimage.sourceforge.net/

Problem: FreeImage.NET library sometimes crashes ComicRack when creating lots of thumbnails in a short time. I have no idea why.
Solution: Resize using GDI+ and use FreeImage for saving only. This seems to work OK.

Problem: FreeImage’s jpeg quality when saving is 75% (JPEG_QUALITYGOOD) or 100% (JPEG_QUALITYSUPERB). 75% looks too bad, 100% creates large files, increasing page loads. 90% is preferred.
Solution: Override predefined enum, because FreeImage source code reveals that lower 7 bits of the enum are used for low-level quality control. So just use 90 🙂

Aug 202012
 
Badaap

Hi comic book lovers,

 

The last few weeks I’ve been working on the integration of the Badaap Comic Reader with the ComicRack Web Viewer plugin.

I’ve been in contact with Neep, the author of the ComicRack Web Viewer plugin, and we quickly came to the conclusion that it would be cool if we would combine forces to make the Web Viewer plugin better by integrating the Badaap Comic Reader.

Unfortunately Neep didn’t have time, so I took it upon myself to implement the changes required in the plugin and to the Badaap web application.

It’s been a fun few weeks, as this was my first project in C#, which is a welcome change after years of C++.

 

The new web viewer has the following advantages:

  • it’s a plugin of ComicRack, so no need for a separate Apache web server
  • you no longer have to scan the library for updated or new files
  • you can use (smart)lists
  • you can perform a global search on series/writer/etc.
  • there is a series list

Folder browsing is missing right now, but I’m working on that.

 Screenshots

Download

 

You can download the plugin here:

Changelog


Amount:

 

Installation

Install it like any other ComicRack plugin. However, as this is a replacement of the Web Viewer plugin, you should uninstall that one first.

The plugin binds to all local ip addresses. It has also the option to bind to one external ip address / dns name allowing outside access if this web server is behind a router.

The plugin will create a folder C:\Users\jeroen\AppData\Local\ComicRack BCR where it will store its settings and store the image cache.

Once installed and running in ComicRack, the new interface can be reached via http://yourip:port/tablet/index.html

If you open that on your iPad in Safari, then you can add it to your home screen.

The original Web Viewer interface is also still available via http://yourip:port/

 

Settings

The Web Viewer has some options that can be set via the web interface itself. You can do this by opening a comic and press the button in the right top of the screen.

The settings will be save in C:\Users\<user>\AppData\Local\ComicRack BCR\settings.xml

The settings   “open_current_comic_at_launch” and “open_next_comic” don’t work yet. They are there for future use.

 

Image caching

Like ComicRack, the web interface shows a lot of thumbnails. You probably know that ComicRack caches pages and thumbnails.

Unfortunately these are unusable by the plugin (unreadable format and wrong size), so I decided to create my own caching in order to speed up page loading.

If I wouldn’t use a cache, then ComicRack has to create each thumbnail anew each and every time the thumbnail is shown. This is very time consuming and thus not desirable.

Right now the cache size is 1024 MB and can not (yet) be changed via the web interface.

You can however change it in the settings.xml file. If you set it to 0 then caching is disabled. You must restart ComicRack if you change it manually.

 

Diagnostics

For testing purposes, the web server’s diagnostics have been enabled.

The diagnostics interface can be accessed via http://your-ip:port/_Nancy

The default password is “diagnostics”.

The password can be set in C:\Users\<user>\AppData\Local\ComicRack BCR\settings.xml

If you leave the password empty, the diagnostics is disabled completely.

 

Source code

The source code of the plugin can be found at https://github.com/jeroenwalter/ComicRackWeb

At the moment the source code only contains the server side portion, i.e. the web server itself.

I still have to add the client side web application to github, but I first have to clean things up a little.

 

Future

I have a long and still growing TODO list as this plugin is far from finished.

One of the more interesting things is, that the web application can theoretically be packaged as a native iPad and Android app with phoneGap.

This would allow the storing of comics on the tablet and thus enabling an offline mode, where you don’t need ComicRack. The app would remember what you read and be able to sync it with ComicRack once you connect to ComicRack.

However, this is totally unfamiliar territory for me and I personally have no need for an offline reader, as I have all my comics on my server with ComicRack.

I will be focusing therefore first on other issues to make the viewer better.

 

Here is the TODO list in no particular order:

server side:

  • BCRModule.cs – Put Settings: only overwrite settings that were specified.
  • Get image tile.
  • Add settings to web viewer plugin dialog. Cache, autostart, etc.
  • bind web viewer to localhost as well as other local ips.
  • use Shadowxxxx properties
  • Select queries on Comics don’t work correctly (linq2rest issues?)
  • class Comic must get same named properties as ComicBook
  • folder browsing

client side:

  • add Select fields to queries so only the necessary fields are returned.
  • lazy load thumbnails
  • destroy images when they scroll out of the viewable area.
  • maximum image dimension of ipad is 4096 on longest edge? Add option to image creation in comicrack.
  • add options to sort, filter and group the comiclist
  • add options to sort the list tree.
  • add option to set the list tree’s root listfolderitem.
  • make image viewer use image tiles in order to avoid jpeg subsampling by ios?
  • optimize image viewer for retina ipad
  • add options for comics: mark as read/unread, blacklist, set page type, mark page as deleted, show/hide blacklisted comics, show/hide deleted pages.
  • add list management: add/remove comic to/from list, make new (smart)list, etc.
  • add color/font themes
  • use localstorage to cache stores and thumbnails ?
  • show/hide treelist view
  • add comic grid view
  • add comic cover flow
  • add split view with comic list and comic info view
  • show next/previous page icon on mouse hover in comic view
  • sort Recently Read on date
  • package with phoneGap to make a real ipad/android app
  • use local storage for offline comic viewing
  • improve app icon + startup screen

 

 

 

Jun 262012
 

Download:

v0.4 Test version (not-minified)

v0.4 Minified version (loads faster on ipad)

 

This release has one major feature: support multiple comic folders.

You can now specify an array of folders that will be scanned for comics in the config.php file.

Previously, all comic filenames were stored in the database as a relative path wrt the $options[“comicfolder”].

After installing and configuring this release, the database will be updated and all filenames are now stored as an absolute path.

As this is a major change, you have to take care to get it right the first time. Make a backup of the comics sqlite database beforehand!

The config option $options[“comicfolder”] has been deprecated and will no longer be used.

Instead the option $options[“folders”] is added.

This option is an array with folders.

If you want the database to be updated correctly, make sure the first array entry points to the folder previously set in $options[“comicfolder”] !

Example:

v0.3

$options[“comicfolder”] = “J:\\comics”;

v0.4

$options[“folders”] = array( “J:\\comics”, “J:\\MoreComics”, “C:\\EvenMoreComics”);

 

You will also notice the options:

$options[“ComicRackDatabase”] = “C:\\Users\\jeroen\\AppData\\Roaming\\cYo\\ComicRack\\ComicDb.xml”;
$options[“ComicRackFolder”] = “C:\\Program Files\\ComicRack”;

These are not yet used, but you may guess where I will need them for….

 

 

Jun 242012
 

Welcome to the new site layout using WordPress.

The theme is still under construction, so don’t be surprised if this site looks different the next time you visit.