Page 1 of 1

Is there a way to remove a horizontal or vertical section of an image?

Posted: Fri Sep 19, 2025 3:46 am
by Steerpike
As noted elsewhere, I'm migrating from IrfanView to XnView because XnView is available on both Mac and Windows, and I'm forced to work in both worlds. Generally, XnView does most of what I need.

There's one nifty feature in IrfanView that I have yet to find an equivalent for in XnView. Functionally, the feature is as follows (actually two conceptually identical features, one for horizontal, one for vertical):

Draw a box anywhere in an image to select a sub-section of the image.
Feature 1 - remove Horizontal strip: Choose a menu option to remove the entire horizontal strip that is defined by the upper and lower horizontal lines of the box.
Feature 2 - remove Vertical strip: Choose a menu option to remove the entire vertical strip that is defined by the left and right vertical lines of the box.
In either case, the 'unused dimension' of the box is immaterial; that is - if you are using 'feature 1', to remove a horizontal strip. the width of the box is immaterial; only the height matters; and similar for 'feature 2' - only the width matters.

The actual menu items are:
Feature 1: (Edit Menu) -> Remove/Insert Strip (uses selection) ->Remove horizontal strip (sel. height)
Feature 2: (Edit Menu) -> Remove/Insert Strip (uses selection) ->Remove vertical strip (sel. width)
(there are two additional features, to INSERT a horizontal or a vertical strip, but I don't ever use those).

So - is there anything like this in XnView, and if not, could it be added?

Here's a quick example of the feature in use. I use it all the time to remove 'white space' from screen shots, so I can eliminate wasted space. Below is a composite image, 'before and after'. On the original screen shot, I drew a box with specific upper and lower lines, and of arbitrary width. I then used the feature to remove the horizontal strip.

https://imgur.com/q8shynx

Image

Re: Is there a way to remove a horizontal or vertical section of an image?

Posted: Fri Sep 19, 2025 4:11 am
by jkm
Steerpike wrote: Fri Sep 19, 2025 3:46 am So - is there anything like this in XnView...
I don't think so. That's one of those weird things Irfanview does that I haven't seen done anywhere else. XnViewMP has the equally weird "Offset" function, which I haven't seen anywhere else either.

The only way I can think to do this in XnViewMP is just to do a cut/paste and then an auto-crop. Obviously that's not a single step though.

It's a perfectly nice bit of functionality, but in all the years I've had Irfanview, I have never once used that function. When I need to edit or otherwise sanitize screenshots, I just do it in Photoshop so I have no constraints, so I've never looked elsewhere...

There's a suggestions forum where you can post a request to add it. You gave a good description. Emphasize how Irfanview has been doing it forever and maybe Pierre will add it out of competitive zeal. :)

Re: Is there a way to remove a horizontal or vertical section of an image?

Posted: Fri Sep 19, 2025 4:34 am
by user0

Re: Is there a way to remove a horizontal or vertical section of an image?

Posted: Fri Sep 19, 2025 6:05 am
by Steerpike
jkm wrote: Fri Sep 19, 2025 4:11 am ...
The only way I can think to do this in XnViewMP is just to do a cut/paste and then an auto-crop. Obviously that's not a single step though.
...
Can you elaborate on this, please? I just did a quick search and it seems that 'auto-crop' will crop the outer edges of an image based on a background color (great for eliminating white borders, etc). In the case I'm describing, I would be creating a 'hole in the middle' of an image and that seems out of scope for auto-crop. Actually, the info I found by googling was about the batch auto-crop feature; I see also an 'Edit'/'Automatic Crop' but I couldn't see a way to use that either.

What I could do (and have done, in the absence of the feature) is to make two copies of the source image in two windows, then crop the first to the 'upper' useful part, and then crop the second to the lower useful part, then 'copy' image 2 and use the (EXTREMELY USEFUL!) Edit / Paste Outside / Bottom, to append image 2 to image 1.

Is there some way I could use auto-crop, do you think?

My current use-case, FYI, is I'm preparing to travel and I'm doing screen-shots of timetables and pasting them into a word doc, which I will have access to on my phone. Space is obviously at a premium in a document targeting a phone, so I want to eliminate all the white space in the screenshots.

Here's a 'before' image, of a timetable from the web:
Image
And here's an 'after' image of the same timetable, after removing 3 horizontal and 2 vertical strips that contained no useful information.
Image

Re: Is there a way to remove a horizontal or vertical section of an image?

Posted: Fri Sep 19, 2025 6:21 am
by Steerpike
user0 wrote: Fri Sep 19, 2025 4:34 am Zealous crop available in Batch convert

request to add it into Viewer:
'Cut Out' a section vertically or horizontally
Wow, 'zealous crop' looks interesting. It does appear to go way beyond what I want (in other dimensions :) ), and also, seems to only try to remove (eg) pure white space (would not remove 'useless but not empty' space). In my example, posted separately in this thread, there are lines and borders all over the place that would seem to interfere with Zealous Crop's purpose. The processing I perform on my images has to be a manual process, because I'm making the judgment call between 'what is useful' and 'what isn't'.

But still - I tried to use it, but - my image is only on the clipboard, not a file. It seems batch processing is file oriented (which makes sense for a batch process, but I just want to process a one-off image on the clipboard).

I did add my vote to the suggestion entry - thanks for the pointer.

Re: Is there a way to remove a horizontal or vertical section of an image?

Posted: Fri Sep 19, 2025 6:53 am
by jkm
Steerpike wrote: Fri Sep 19, 2025 6:05 am
jkm wrote: Fri Sep 19, 2025 4:11 am ...
The only way I can think to do this in XnViewMP is just to do a cut/paste and then an auto-crop. Obviously that's not a single step though.
...
Can you elaborate on this, please? I just did a quick search and it seems that 'auto-crop' will crop the outer edges of an image based on a background color (great for eliminating white borders, etc). In the case I'm describing, I would be creating a 'hole in the middle' of an image and that seems out of scope for auto-crop. Actually, the info I found by googling was about the batch auto-crop feature; I see also an 'Edit'/'Automatic Crop' but I couldn't see a way to use that either.

Is there some way I could use auto-crop, do you think?
Zealous Crop is based on color, so I don't think it can help you any more than what I was suggesting.

And yes when I say auto-crop I'm talking about Edit->Automatic Crop in the XnViewMP viewer tab (the viewer tab is what you get when you double-click an image to open it in XnViewMP).

So to elaborate, let's consider your first example, because you're only removing one stripe, so it's easier to explain. But the process is fundamentally the same for your later example with the timetables.

The reason you're puzzled is that a) you have to think outside the box and b) you haven't tried it. :)

The key to the process I described is selecting what you want to keep, not what you want to delete.

So what you do is this:
Open the image. Don't select the stripe you want to remove. Select the entire upper portion you want to MOVE DOWN. After Select, Cut. That will leave black space where the content was cut. Then Paste.
When you Paste, there will be a selection box around the pasted content. Now you can DRAG the pasted content down to where you want it, covering up the stripe you want gone. Now click the Apply button to drop the selection and remove the selection box.
After you do this, there will be black space at the top of the image.
Auto-Crop can remove that black space automatically. Try it.

You can do this cut/paste/move more than once in an image, and just do one auto-crop at the end. Each time you do the cut/paste/move you will be leaving more black space at the top, bottom, wherever.

It is obviously much less efficient than what Irfanview offers, I said that at the outset. But this is the easiest way I can think to do it in XnViewMP.

Make sense?

Re: Is there a way to remove a horizontal or vertical section of an image?

Posted: Fri Sep 19, 2025 7:39 am
by user0
jkm wrote: Fri Sep 19, 2025 6:53 am Zealous Crop is based on color, so I don't think it can help you any more than what I was suggesting.
not only color, but empty space as well

so, I don't see any reason why it shouldn't work with selection:
user0 wrote: Mon Jun 05, 2023 6:03 pm Zealous crop functionality can be added to Crop panel via checkbox,
if enabled - part of the image will be cut out based on selection's sides:
- long side - continued to the image edges and represent length of cut out
- short side - represent width of cut out
- equal sides - do nothing

Re: Is there a way to remove a horizontal or vertical section of an image?

Posted: Fri Sep 19, 2025 8:09 am
by Steerpike
jkm wrote: Fri Sep 19, 2025 6:53 am ...
When you Paste, there will be a selection box around the pasted content. Now you can DRAG the pasted content down to where you want it, covering up the stripe you want gone. Now click the Apply button to drop the selection and remove the selection box.
...
OK, trying it now! I got as far as the above step - I pasted, the content appeared and could be dragged down to where I wanted it ... and then ... I'm stuck! Where, oh where, is the 'Apply' button?! I looked everywhere ... I'm sure I'll be laughing when you tell me but I really don't see it. I did try hitting 'enter' but that didn't do it.

Edit to add: OK - I got it to work, I think, but using slightly different steps.
1) select the top part of the image I want to move down (click/drag the selection square around it)
2) hit cmd-x to cut it (I'm using a Mac at the moment)
3) This removes the top part of the image, but - the selection box remains (but is now empty).
4) drag this empty selection box down to the new desired spot
5) hit cmd-v to paste back the section, which is pasted inside the existing selection box I just dragged down.
6) click elsewhere on the image (outside of the selection box) and ... I now have the image with the top part moved down.

This obviously differs from what you describe but following your method, I just don't know how to 'apply' the content of the box. Clicking outside the box may be the answer ... let me try again.

Tried again; trying to follow your steps exactly, when I 'cut' the top part, it's leaving the selection box in place. If I click elsewhere to dismiss the selection box, then hit cmd-V (paste), the removed part is pasted right back where it came from, and there's no selection box around it to facilitate it's movement. But if I leave that text box there, and paste back into it, the image is pasted right back to the original spot again and moving the text box doesn't move it. I swear I saw that the first time I tried, though!

Re: Is there a way to remove a horizontal or vertical section of an image?

Posted: Sat Sep 20, 2025 3:03 am
by jkm
My apologies, I accidentally mislead you because I was running a different version from you.

If you're using XnViewMP version 1.9.3, the procedure would be like you describe, and a slightly different order from my previous post:

Select, Cut, Move the selection box, then Paste. Then ESC or click elsewhere to dismiss the box. You don't have an Apply button.

Otherwise the concept is the same. The cut/paste leaves a black area that you can then autocrop, and you can do the cut/paste multiple times and then autocrop at the end.

My first post to you was correct. But then when you needed additional instructions, I gave you a step-by-step but unwittingly used a different version that has slightly different steps.

But I'm glad you figured it out. At least I got you pointed in the right direction, and you're able to do what you need, albeit less efficiently than in Irfanview. But wait a while, and XnViewMP will get better.

Re: Is there a way to remove a horizontal or vertical section of an image?

Posted: Sat Sep 20, 2025 3:21 am
by Steerpike
jkm wrote: Sat Sep 20, 2025 3:03 am My apologies, I accidentally mislead you because I was running a different version from you.

If you're using XnViewMP version 1.9.3, the procedure would be like you describe, and a slightly different order from my previous post:

Select, Cut, Move the selection box, then Paste. Then ESC or click elsewhere to dismiss the box. You don't have an Apply button.

Otherwise the concept is the same. The cut/paste leaves a black area that you can then autocrop, and you can do the cut/paste multiple times and then autocrop at the end.

My first post to you was correct. But then when you needed additional instructions, I gave you a step-by-step but unwittingly used a different version that has slightly different steps.

But I'm glad you figured it out. At least you're able to do what you need, albeit less efficiently than in Irfanview. But wait a while, and XnViewMP will get better.
Thanks! Yes, there is a way to achieve the goal. For the example I gave (3 horizontal and 2 vertical 'slices'), it's too tedious and it's faster to just use my windows laptop, but most often, I'm just eliminating one or two 'slices' so your method could work.

I do have IrfanView available through a VM on the Mac, and I recently figured out how to load IrfanView in a 'Wine' container on the Mac, but both are troublesome when dealing with screenshots (clipboard issues). My biggest challenge with XnView relative to IrfanView in general is the completely different set of keyboard shortcuts; and the Mac version is even more challenging in the keyboard shortcut department. I'm slowly adapting to the requirements, however!