Based on Opencv python to achieve batch image removal black edge - cropping - compression software

Introduction

Process image files in batches, extract each frame of GIF images in batches, and have functions such as range cropping, automatic removal of black/white edges, resizing, and volume compression.

First look at the interface of some software, which is a GUI written based on Tkinter

Cropping and other functions are based on Opencv 

 

download

 I added github that handles GIFs:

 The original author's github: hiroi-sora/Umi-CUT: A tool for removing black borders/cropping/compression of images in batches, with an interface. It can eliminate the interference of color blocks on the edge of the picture and delete the black edges. Based on Opencv. (github.com)

Instructions for use

Prepare

Python users: Download the source code, install Opencv and other required modules.

Remove black borders with one click

  1. Open the main program, drag any  picture/folder  into the white background table area in the window, or click  Browse on the upper left  to select a picture.
  2. Click on the upper right  to start the task  and wait for the progress bar to finish.
    • While the task is in progress, you can click  the terminate task (the original start task button) to stop at any time, but it will still start from the beginning next time.
  3. View the output image in   the folder  under  the directory of the first image .# 裁剪

 

Other parameter settings

Click  the Settings  tab, click  Parameter Settings  to open the configuration window. Just adjust the parameters according to the prompt.

  • The red box is the range of manual cropping. The dotted frame is based on manual cropping, and the remaining black borders are automatically removed.
  • Toggle the color of the auto-crop edge to black/white.
  • If the black border of the image to be processed contains a small amount of variegated color and noise, increase 中值滤波the parameter. (but too high a filter value may leave very narrow black borders)
  • If the black border of the image to be processed is not pure "black", increase 阈值the parameter. (However, if the threshold is too high, the part that needs to be kept may also be cropped)

One-click cropping

As shown in the figure, I will crop the following two columns of data: the left and right positions need to be set in manual cropping

 After selection, you can click preview to view

 Click OK to start the task

 You can see, and crop out in batches

 

One-click conversion GUI

Click to process GIF and select input address and output address 

Guess you like

Origin blog.csdn.net/weixin_45897172/article/details/131447039