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 🙂