Download: latest (1.8.0)

pymagery — python imagery


1.7.0 documentation / bitplane_split plugin

Bit plane splitting is the opposite of the bitplane_merge process. This plugin takes a single grayscale image and splits each bit plane into a separate, monochrome image.

The plugin prototype is:

p0,p1,p2,p3,p4,p5,p6,p7 = def bitplane_split()

This plugin returns 8 monochrome images. p0 is the least-significant bit plane and p7 is the most-significant bit plane.

The following example splits an image, saves each bit plane, then merges them back into a duplicate image:

import pymagery i = pymagery.image('foo.ppm') original = i.copy() planes = i.bitplane_split() [planes[k].save('foo-bitplane-%d.ppm' % k) for k in range(len(planes))] i.bitplane_merge(*planes)

bitplane_merge takes 8 arguments but they can be supplied by expanding the list by prefixing with an asterisk. Equivalently, i.bitplane_merge(planes[0], planes[1], planes[2], planes[3], planes[4], planes[5], planes[6], planes[7]) could be called instead.

An example image is shown below:

Bit Plane Result Image
Merged
7
6
5
4
3
2
1
0

The most-significant bit planes contain the most structure of the image while the least-significant bit planes appear more as noise. This observation is the basis of steganography (imperceptible hiding of data in images).

Change Log