[ACCEPTED]-Is there an easy way to cut a slice from an image using Gimp?-gimp

Accepted answer
Score: 28

Here is a method that is quick and often 5 does what you want:

  1. Cut out the middle, leaving a transparent "hole".
  2. Click anywhere to remove the selection (so the hole is not selected).
  3. Click Image > Zealous crop .

Zealous crop demo

This is going to remove 4 the middle part. However, if you also have transparency 3 in other parts of the image (like around 2 the edges) it's going to remove that transparency 1 too.

Score: 1

I believe you're asking to do something 13 like cut out the middle of a page, leaving 12 the header and footer and have the blank 11 space removed with the cut action, effectively 10 joining the header and footer together.

To 9 my knowledge, I don't believe so. Even 8 if you cut, or delete, that space is still 7 part of the image even without content.

But, you 6 would be able to highlight the top or bottom 5 (or left or right) of the remaining space 4 and drag it to align with the other side. It's 3 not ideal for repetitive tasks, but should 2 get you through if you only have to do it 1 a few times.

Score: 1

Install Python and the Python Imaging Library. Back 8 in GIMP, select and cut the full-width areas 7 you don't want to transparent, and export 6 the image to test.png. Then use this Python code 5 (works only if complete lines are transparent; will 4 not work properly if there are 100%-transparent 3 pixels anywhere other than on a full-width 2 row)—

from PIL import Image
i = Image.open("test.png")
b = i.tobytes()
b2 = ''.join(b[n:n+4] for n in xrange(0,len(b),4) if ord(b[n+3]))
newHeight = len(b2)/i.width/4
i2 = Image.frombytes('RGBA',(i.width,newHeight),b2)

Then re-load test.png and verify that the areas 1 you cut have gone.

Score: 0

In gimp 2.8.1 you can easily create a new 4 image from a selection. So if you select 3 a rectangular than do a copy (Ctrl-C) and 2 a past in a new image Edit -> Paste as 1 -> new image (or Ctrl-Shift-V).

More Related questions