leptonica

Convert Leptonica PIX data to Java BufferedImage

This snippet allows us to convert Leptonica PIX data into Java BufferedImage, in my case the pix->data could be compressed using zlib so I am decompressing before recreating image. We are assuming here that this is bi-tonal image(1 bpp) Sample Usage BufferedImage image = LeptonicaUtil.convert(zlibData, width, height, 1); ImageIO.write(image, "png", new File("C:/temp/test.png")); BufferedImage image = …

Convert Leptonica PIX data to Java BufferedImage Read More »

Leptonica Tutorial – Cropping

Common use is to crop to certain area of an image, this can be quite easily accomplished with following code. BOX* box = boxCreate(x, y, w, h); PIX* dpix= pixClipRectangle(spix, box, NULL);BOX* box = boxCreate(x, y, w, h); PIX* dpix= pixClipRectangle(spix, box, NULL);