Follow

Snapshot quality

Android devices tend to be rather memory constrained, and in order to use as little memory as possible Pugpig will compress the page image snapshots. Sometimes, the compression doesn't do a very good job, resulting in noticeable distortions when swapping between the snapshots shown while scrolling and the actual web view. You can improve the quality of the snapshots at the cost of extra memory use.

Internally, Pugpig will store the snapshots as 16 bit colour by default (technically, Bitmap.Config.RGB_565). If the colour of your snapshots doesn't look right, you can force Pugpig to use 32 bit colour by adding this line to your app delegate's didFinishLaunching:

    BitmapUtils.preferredConfig = Bitmap.Config.ARGB_8888;

Pugpig uses JPEGs at 75% quality to store the snapshots. These values have been chosen as a good compromise between quality and size, but you can adjust them if appropriate. For example, if you want your snapshots to be completely lossless, you can force Pugpig to save them as PNGs.

To modify the quality settings, access your document's imageStore and use

    setCompressFormat(desiredFormat);
    setCompressQuality(desiredQuality);

The format is defined by Bitmap.CompressFormat, and the quality is a value that has a meaning related to the compression format - see the Android documentation for details.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk