Image enhancement Pixelnetica™ Document Scanning SDK for Apple iOS
Enhancement turns a raw photo into a clean “scanned” look: sharpened text, flattened lighting, and a colour mode that suits the document. In DSSDK this is a colour profile applied while the page is processed.
In the ready-to-use flow this happens inside the crop editor. With the engine you choose the profile yourself.
Colour profiles
PxColorProfile selects the output style:
| Profile | Output | Best for |
|---|---|---|
PxColorProfile_BW | High-contrast bilevel (black & white) | Text documents — crispest text, smallest files. |
PxColorProfile_Gray | Greyscale | Documents with shading, or photos you want neutral. |
PxColorProfile_Color | Content-aware colour | Receipts, forms, ID cards — anything where colour matters. |
PxColorProfile_None | The source image, unprocessed | Photos, or OCR on pages with complex shadows and highlights. |
Black & white binarises the page to pure black-on-white. It gives the sharpest text and the smallest output, and when you save to PDF or TIFF the bilevel page is stored with lossless compression (JBIG2 in PDF, CCITT Group 4 in TIFF) — so the text stays crisp no matter how hard you compress the colour pages around it.
Greyscale keeps the page’s tones instead of collapsing them to pure black-and-white. Like black & white it flattens uneven lighting and sharpens text, but it preserves shading and soft edges — a good middle ground for pages with pencil marks, faint stamps, or photos that hard binarisation would crush, when full colour isn’t needed. File size sits between black & white and colour.
Colour is content-aware: the SDK analyses the captured page and flattens uneven lighting while preserving the original colours, turning a photographed receipt or form into something that reads like a flatbed scan.
None does no colour processing at all — you get the source image (cropped and dewarped if you rectified it, otherwise untouched). Reach for it when binarisation would lose information: ordinary photos, or OCR on pages with complex shadows and highlights where the recogniser does better with the original tones.
Applying a profile
Build a PxRefineFeatures, set the colour profile on it, then apply it with picture.refine(_:):
import DocScanningSDK
let features = PxRefineFeatures()
features.use(PxColorProfile_BW, forPic: picture) // choose the colour mode
picture.refine(features) // apply it (resets the builder)
let enhanced = picture.extractImage() // the processed page
Related controls on PxRefineFeatures (each returns the builder, so they chain):
overrideStrongShadows(_:)— handle documents with strong shadows.normalizeOrientation()— straighten the page orientation.ignoreColorHint()— ignore the capture-time colour hint when deciding processing.
Tips
- Default to
PxColorProfile_BWfor text — it gives the sharpest, smallest result. Switch toColoronly when the document’s colour carries meaning. - Let users pick the profile and re-process — the colour mode is a per-page choice, not a global setting.
See also
- Edge detection & cropping — produces the
PxRefineFeaturesyou enhance. - Export — write the enhanced page to a file.