Image Cropping Tool Written in Python3
During many of my previous computer graphics and visualization projects, I needed to create screenshots of rendering results to include as figures in a thesis, report or paper. However, the screenshots my visualization programs output are usually exactly the size of the viewport. So every time when I wanted to include some visualization result, I needed to first make sure that the data set fills a large portion of the screen and then manually crop the image to remove unwanted borders.
Repeating this process over and over is really bothersome, so I took the time to write a small tool that does this work for me in an automated fashion. A link to the program can be found here: https://github.com/chrismile/crop
Figure 2: A carved cube hex-mesh data set by Livesu et al. 2 rendered using https://github.com/chrismile/HexVolumeRenderer. The scaled Jacobian (a measure for cell deformation) is mapped to color and opacity.
The program is relatively simple, as it can only detect single-color backgrounds. It can also cope with RGBA images. Optionally, the user can specify a border size in pixels that should be kept when cropping.
Marco Livesu, Nico Pietroni, Enrico Puppo, Alla Sheffer, and Paolo Cignoni. 2020. LoopyCuts: Practical Feature-Preserving Block Decomposition for Strongly Hex-Dominant Meshing. ACM Transactions on Graphics 39, 4 (2020). https://doi.org/10.1145/3386569.3392472 ↩︎