Page 1 of 1

Extend png canvas size by a few pixels?

Posted: Wed Dec 26, 2018 1:55 pm
by scriptor
I've got a couple of png files that need to be altered in order to OCR them with Tesseract.
The dimensions are 100 x 13 pixels and I need to add 3 pixels to the bottom side of the images, resulting in 100 x 16 pixels.
(To enhance the contrast I add the -binary parameter as well.)

So basically what I'm looking for is the equivalent of the XnView command
Canvas resize: Add 3 dots/pixels from Top-Center of background/custom colour (#f6f6f6)
Is this feasible with NConvert?

Re: Extend png canvas size by a few pixels?

Posted: Wed Dec 26, 2018 2:28 pm
by cday
You have the NConvert help file (-help) have you?

I would think the following option should work, if you try it:

Code: Select all

-canvas w h pos   : Resize canvas
              w h can be percent (ex: -canvas 100% 200%)
              or #x #y for offset
              pos top-left, top-center, top-right
                  center-left, center, center-right
                  bottom-left, bottom-center, bottom-right

You could check if setting w and h to the desired canvas dimensions works, and if not try the offset option, I'm not sure about that...

But will Tesseract produce useful output from such small pixel dimensions?