CHOP

(Image Magick's definition of Chop)

<width>x<height>{+-}<x>{+-}<y>{%}

"Remove pixels from the interior of an image."
"Width and height give the number of columns and rows to remove, and x and y are offsets that give the location of the leftmost column and topmost row to remove."

Ok, lets see if I get this.

Made an Azure 350x250 gradient to use as an example.

(To learn to make BGs at IM, use link at the bottom of the page)

Swirl 60000 and Implode -8



Went to Transform, clicked the chop button
The 1st two #s are how much I want to chop out, the last two are:

1.) Width: the number will be how far from the left side of the image (into the width), I want the chopping to begin.

2.) Height: The number will be how far from the top of the image (into the height), I want to begin chopping.


I'll make the 1st example simple. I want to take a 50x50 piece out of the center of my 350x250 image. My parameters will be:
50x50+150+100

Result: 300x200




For the next example I decide to frame the image to see how smooth the chop will be on the frame
Decorate 20x20+5+5, gray18

Now the image is 390x290
This time I want to chop out a 90 pixel width out of the center, the full 290 pixel length of the image. My parameters are going to be:
90x0+150+0

Result: 300x290




And a to get little more extreme I'll use the unframed original & chop 250 out of the width and leave the height alone.
Parameters
250x0+50+0




For the next example I will use a picture of 4 tiger cubs to see if I can remove one of them

Original: 280x220



Added a 5x5 black border & 10x10+3+3 frame
That made the image 310x250
I had to fool around with the parameters but finally settled on:
70x0+140+0

Result: 240x250



Admittedly this is sloppy (the frame looks great). To do something like this and have it blend smoothly, the BG would have to be the same all over, but you get some idea of the possibilities.


I used real easy #s for my widths and heights. Had my 2nd example been 350x250 and I wanted to crop out 90 (90 pixels of width, the full length of the image), and keep it centered, to figure out my 3rd parameter I would need to find the center of my intended result.
So, 350-90=260. Half of 260 is 130, so 130 is where I would want to start chopping into the width. My parameter would be:
90x0+130+0



My last example concerns the way this tool will probably be most commonly used; which is removing part of a framed image without having to go to the trouble of cropping off the frame, then recropping the image and re-framing.

The original has more length than it needs and the bulk of Jerry's scuba gear is not exactly flattering
The original is 260x350 including the 10x10 frame.
I am going to guess I can chop out about 100 pixels (nice easy # to start with). Now I only want to remove length yet keep the bottom 10 pixel edge of the frame so
350-100=250 & 250-10 (for the frame) is 240.
The first parameters I tried were 0x100+0+240

0x100 represents how much I want to chop,
so none of the width and 100 of the length.
+0+240 represents where I want to start chopping,
so again, none of the width and 240 pixels down into the length to chop out that 100 pixels

Lucky me! I'm happy with the first try. I got rid of the blotchy over-sized looking bouyancy compensator and am left with what I see as the focal point of the image! I could go a step further and chop out a bit of the blue on the left side, but some other time.

Original

Result



Actually I got this in 2 trys. I messed up the first time and put 0x100+0+100 (don't know what I was thinking), and ended up with his butt around his neck. After staring at the parameters I realized my error and got it right.

One little oddity: I went back and wrote my parameters as 260x100+260+240 and got the exact same results. I'm sure if I think about it, it'll make sense but my logic says to put 0s when I want an area left alone.

~~~~~~~~~~~~~~~~~~~~~~~~~~~
My Notes:
If I put in impossible numbers for parameters, there is no change. So if you try this and nothing happens, go back and check your parameters.
If I put in wacko numbers but they work, I get some pretty weird chopped up images
By the "equation" of the parameters given by IM it appears one could use percents. I haven't tried yet. The very same equation is given for Crop. About the only difference is that with crop, the 1st two numbers are how much width & height you want to have remaining, instead of how much you want gone. And the 2nd two are how much to crop from the left and how much off the top, instead of how far in to the left and the top do you want to start chopping.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here is Image Magick's Chop definition in it's entirety. Any time I find a piece of a definition I think I understand, I take that little piece and run with it to minimize brain pain. I'll try the rest on for size later.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CHOP <width>x<height>{+-}<x>{+-}<y>{%}
"Remove pixels from the interior of an image Width and height give the number of columns and rows to remove, and x and y are offsets that give the location of the leftmost column and topmost row to remove."


"The x offset normally specifies the leftmost column to remove.

If the gravity option is present with NorthEast, East, or SouthEast gravity, it gives the distance leftward from the right edge of the image to the rightmost column to remove.

Similarly, the y offset normally specifies the topmost row to remove, but if the gravity option is present with SouthWest, South, or SouthEast gravity, it specifies the distance upward from the bottom edge of the image to the bottom row to remove.

The chop option removes entire rows and columns, and moves the remaining corner blocks leftward and upward to close the gaps."

~~~~~~~~~~~~~~~~~~~~~~~~~~

There could be ways to use this that are as yet undiscovered.
Only time and experimentation will tell!


by ~Stranjer





Related Pages...More ways to get weird at IM

...but first, the fine print
Warning: My tutorials are experimental works in progress. I will add to them as I learn more about the combinations of effects I am trying to describe and try to refine my techniques and explanations, There are two other factors that are important here.
1. All images are NOT created equal. What works with one, may not work with another.
2. Things change at Image Magick from time to time, sometimes radically. I try to keep these pages updated.


Color Wrapping Images

Enhancing Gray Shade (Emboss)

Mock Emboss

Equalize Experiments

Using Level

Using Chop
remove interior areas


Making BGs at IM
for Classic and Plus units


FX-Dif Circulars