Page 1 of 1

Resizing to 100% x 1pixel

Posted: 2010-03-02T10:08:41-07:00
by jaffamuffin
Hi

How can I take a set of images, which will be roughly 2300x3300 pixels and resize this to 2300x1, or in the case of a 2345x3230 sized image, resize this to 2345x1.

Essentially I want 100% image width, but 1px height. I can't seem to get IM to do this. The only way I can make it do it is using ! but I need to know the original size of the image.

If I use 100% x 1 It doesn't resize to 1 pixel.


Any ideas?

Re: Resizing to 100% x 1pixel

Posted: 2010-03-02T10:24:13-07:00
by snibgo
Inelegant solution (Ubuntu):

Code: Select all

convert input.png -resize `convert input.png -format %[fx:w] info:`x1! output.png

Re: Resizing to 100% x 1pixel

Posted: 2010-03-02T11:14:53-07:00
by fmw42
100%x1 is the same as 100%x1% or 100x1%. If IM sees a %, it applies it to both.

try

convert image -resize "100x0%!" result

0% means 0 size, but IM will make it 1 pixel (from my testing).

Re: Resizing to 100% x 1pixel

Posted: 2010-03-03T03:26:08-07:00
by jaffamuffin
convert image -resize "100x0%!" result

Ahh yes thanks that does work. I actually tried using 0 as a token but kept getting image errors.

my command is convert left.tif -resize "100x0%!" +repage -threshold 210 c:\out2.tif

I'll output this to text locate the first block of black on the right of the page which should be the spine of the scanned book. The perform a page size crop to extract only the page sized data.

Similar in a way to my set of scripts here viewtopic.php?f=1&t=14443