Remove black background from images

Ask for help and post your question on how to use XnView MP.

Moderators: XnTriq, xnview

Post Reply
SteelMassimo
Posts: 2
Joined: Tue Feb 05, 2019 8:57 pm

Remove black background from images

Post by SteelMassimo » Tue Feb 05, 2019 9:11 pm

Hello everyone!

I'm new to the software, so please bear with me :mrgreen:

I have a bunch of images containing white paper on a black background(which is full of little white dots). I need to get rid of this this background, while at the same time resizing the image so that only the white paper is shown.

Is there a particular action flow that you guys reccomend? Crop maybe?

Here's a sample of how it is and how it should become.

Thanks for the help!
Attachments
Target_image.png
This is how it should become
Original_Image.tif
This is how it is
(66.65 KiB) Downloaded 13 times

User avatar
XnTriq
Moderator & Librarian
Posts: 5445
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Remove black background from images

Post by XnTriq » Tue Feb 05, 2019 9:35 pm

Welcome to the forum, SteelMassimo.

ToolsBatch convert…Settings:
  • Preview background color [ ]
ToolsBatch convert…Actions:
  • MapNegative
  • ImageAutomatic deskew
  • MapNegative
  • ImageCropFrom position (pixels)
    X [ 420 ]
    Y [ 125 ]
    Width [ 1220 ]
    Height [ 1830 ]
p154541.tif
Result
(10.95 KiB) Downloaded 11 times

SteelMassimo
Posts: 2
Joined: Tue Feb 05, 2019 8:57 pm

Re: Remove black background from images

Post by SteelMassimo » Wed Feb 06, 2019 5:59 pm

Hello XnTriq!

Thanks for the answer, is solves my problem partialy...see, it's a lot of images, and there is a lot variation in resolution and the position of the white page (normaly it contains text). The firt 2 instructions are fine, but the crop is completely dynamic, as the white part can appear anywhere on the black background.

Sorry if I did'nt explain in full detail. Here is another example of what can happen.

In this file, height is bigger than width, the paper is still in the middle, but the position can vary o lot for the whole package (need to batch convert around 7000 images). The white dots on the background can also be a bit of an issue.

Is there any other action that allows me to remove the background more dynamicaly?
Attachments
Original_image2.tif
(1.7 KiB) Downloaded 7 times
Target_image2.png

User avatar
XnTriq
Moderator & Librarian
Posts: 5445
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Remove black background from images

Post by XnTriq » Wed Feb 06, 2019 8:45 pm

SteelMassimo wrote:
Wed Feb 06, 2019 5:59 pm
The white dots on the background can also be a bit of an issue.
Yes, ImageAutomatic crop… won't do the trick.
SteelMassimo wrote:
Wed Feb 06, 2019 5:59 pm
Is there any other action that allows me to remove the background more dynamicaly?
Have you looked into document scanning apps?
Related topic: "Cropping" and saving

User avatar
XnTriq
Moderator & Librarian
Posts: 5445
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Remove black background from images

Post by XnTriq » Wed Feb 06, 2019 11:00 pm

Scan Tailor Advanced

p154589_1.png
p154589_1.png (7.03 KiB) Viewed 293 times
p154589_2.png
p154589_2.png (1.68 KiB) Viewed 293 times

Post Reply