Page 1 of 1

Tile crop, overlap and final image size

Posted: 2011-09-11T19:49:12-07:00
by xpt
Hi,

I'm just trying to figure out exactly how the overlapping affect the tile cropping. Let me explain with an example:

Code: Select all

$ convert logo: -crop 4x1@ +repage +adjoin logo_%d.gif

$ identify logo_?.gif
logo_0.gif GIF 160x480 160x480+0+0 8-bit PseudoClass 256c 2.97KB 0.000u 0:00.000
logo_1.gif[1] GIF 160x480 160x480+0+0 8-bit PseudoClass 256c 9.55KB 0.000u 0:00.000
logo_2.gif[2] GIF 160x480 160x480+0+0 8-bit PseudoClass 256c 21.2KB 0.000u 0:00.000
logo_3.gif[3] GIF 160x480 160x480+0+0 8-bit PseudoClass 256c 7.21KB 0.000u 0:00.000
Now I want the tile cropped images to be of 212 pixel width. Since 212-160 = 52, intuitively I'll do:

Code: Select all

convert logo: -crop 4x1+52@ +repage +adjoin logo_%d.gif
but the result is now what I was expecting:

Code: Select all

$ identify logo_?.gif
logo_0.gif GIF 199x480 199x480+0+0 8-bit PseudoClass 256c 4.34KB 0.000u 0:00.000
logo_1.gif[1] GIF 199x480 199x480+0+0 8-bit PseudoClass 256c 11.4KB 0.000u 0:00.000
logo_2.gif[2] GIF 199x480 199x480+0+0 8-bit PseudoClass 256c 25.7KB 0.000u 0:00.000
logo_3.gif[3] GIF 199x480 199x480+0+0 8-bit PseudoClass 256c 14.5KB 0.000u 0:00.000
What causes such difference?
How can I calculate the correct amount for the overlapping?

Thanks

Re: Tile crop, overlap and final image size

Posted: 2011-09-11T20:28:50-07:00
by fmw42
You cannot do what you want by that method. I don't think equal size crop method allows offsets

Either you crop with 212 width and let the last image be some other size or you crop and pad to 212.

convert logo: -crop 212x480 +repage +adjoin logo_%d.gif

or

convert logo: -crop 212x480 +repage gravity center -background white -extent 212x480 +adjoin logo_%d.gif

or

convert logo: -crop 4x1@ +repage -gravity center -background white -extent 212x480 +adjoin logo_%d.gif

Re: Tile crop, overlap and final image size

Posted: 2011-09-14T19:06:28-07:00
by anthony
Cropping using (near) equal size cropping does support overlaps. Howevr the value you give is the number of pixels that is shared between images, as such it gets counted twice!

Also it depends on another flag whether edge images should also contain a "border" area (and thus all images are equal in size - the default), or not (and thus edges are a little smaller) add a '!')

To see the differences in how the flags work see...
Separating Spaced-out Tiling Images
http://www.imagemagick.org/Usage/crop/#crop_spaced

There are three methods of spacing. no-overlap (montage-like), overlap with border (resulting images are same sized), overlap without border (edge images slightly smaller -- add a '!' flag as well)