Page 1 of 1

-extract

Posted: 2008-11-29T12:06:55-07:00
by rmabry
In the command-line -options doc, under -extract, the following is missing a single quotation mark:
convert -size 16000x16000 -depth 8 image.rgb[640x480+1280+960]' image.rgb image.png
Actually, I find the examples given for this to be unnecessarily complicated for the typical extract operation. Here's the entire entry:
-extract width
-extract widthxheight{{+-}offset}

extract the specified area from image. The option is most useful for extracting a subregion of a very large raw image. Note, these two command are equivalent:

convert -size 16000x16000 -depth 8 -extract 640x480+1280+960 image.rgb image.png
convert -size 16000x16000 -depth 8 image.rgb[640x480+1280+960]' image.rgb image.png
The examples above produce multiple images. How about something simpler, like this?

convert -extract 640x480+1280+960 bigImage.rgb extractedImage.rgb
convert 'bigImage.rgb[640x480+1280+960]' extractedImage.png
The option's form -extract width does not give an extracted image for me, just a resized one. I'm not sure what such a form should reasonably be expected to do, though.

Finally, I am confused by the results of the following two commands, which I guess means I am confused about -geometry, in general:
convert -extract x55+0+0 logo: horizontalWiz.png
convert -extract 55x+0+0 logo: verticalWiz.png
The first gives something I expect, a horizontal extraction of dimensions 640x55 from the top of the logo, the width coming from that of the input image (logo, 640x480). So I'd like the second to give me a vertical strip with dims 55x480, but it gives an error, "convert: geometry does not contain image `LOGO'."

If I use "48" in place of "48x" I get an " invalid argument" error.

Rick

Re: -extract

Posted: 2008-11-29T13:57:21-07:00
by el_supremo

Code: Select all

convert -extract 55x+0+0 logo: verticalWiz.png
works for me with IM 6.4.4 on Win XP

Pete

Re: -extract

Posted: 2008-11-29T14:17:29-07:00
by rmabry
el_supremo wrote:

Code: Select all

convert -extract 55x+0+0 logo: verticalWiz.png
works for me with IM 6.4.4 on Win XP

Pete
Ha! This is me, also on XP: Version: ImageMagick 6.4.5 2008-10-24 Q16

It gives the error,

convert: geometry does not contain image `LOGO'.

Exactly the same for Version: ImageMagick 6.4.4 2008-10-19 Q16 on Linux.

Can someone else report?

Thanks, Pete.

Rick

Re: -extract

Posted: 2008-11-29T14:41:59-07:00
by magick
We tried ImageMagick 6.4.6-5 under Windows and the extract option worked properly without complaint.

Re: -extract

Posted: 2008-11-29T15:02:54-07:00
by Bonzo
Worked OK for me without an error as well - Windows XP
If I use "48" in place of "48x" I get an " invalid argument" error.
I pressume you are getting an error as this is the widthxheight if you leave either the width or the height out there is a default setting but you can not leave the x out as the code must be looking for it.

Re: -extract

Posted: 2008-11-29T16:03:14-07:00
by rmabry
Bonzo wrote:Worked OK for me without an error as well - Windows XP
Strange. Thanks for trying it. You didn't mention which version you're using, but I now suspect it won't matter!
If I use "48" in place of "48x" I get an " invalid argument" error.
I pressume you are getting an error as this is the widthxheight if you leave either the width or the height out there is a default setting but you can not leave the x out as the code must be looking for it.
Well, this option is not one I want, but I did want to mention it. I'm getting it, as I said, from this part of the doc for -extract:

-extract width
-extract widthxheight{{+-}offset}

I'm trying (again) to figure out this x business. Using x48 makes sense to me. Therefore, using 48x does, too. My experiments with it give errors, so I'd hoped a bare 48 was intended for what I thought 48x would do.

Sheesh.

Rick

Re: -extract

Posted: 2008-11-29T16:15:40-07:00
by magick
We get the correct results with this command:
  • convert -extract 48x+100+100 logo: x:
When the height is missing it substitutes the image height. So in this example the extract argument given is the same as 48x580+100+100. Note that the above command is equivalent to this command:
  • convert 'logo:[48x+100+100]' x:

Re: -extract

Posted: 2008-11-29T17:05:19-07:00
by rmabry
magick wrote:We get the correct results with this command:
  • convert -extract 48x+100+100 logo: x:
Not me. Not on WinXP 6.4.5 nor on 6.4.4 Linux.
When the height is missing it substitutes the image height. So in this example the extract argument given is the same as 48x480+100+100. Note that the above command is equivalent to this command:
  • convert 'logo:[48x+100+100]' x:
Thanks, and I understand what should happen. And this is, in part, academic, since I can work around these issues. But just for the record, the command above fails likewise for me at present.

convert: geometry does not contain image `LOGO'.

This works:

convert 'logo:[48x480+100+100]' wiz.png

Weird, weird, weird.

I appreciate all the trouble you've taken.

Rick