crop whitespace from an image

版本 1.2.0.0 (2.4 KB) 作者: Andrew Bliss
CROP gets rid of whitespace around an image
4.1K 次下载
更新时间 2012/6/1

查看许可证

CROP(FILENAME,APPEND,MARGIN) is the full calling form. APPEND and MARGIN are optional inputs.

CROP('filename.ext') crops the image in the file and saves it using the original filename, overwriting the old image. The extension (ext) can be anything IMREAD supports.

CROP(directory) crops all images in a directory.

If APPEND is 1, CROP saves the cropped image as 'filename_crop.ext' in the same directory as the original.

MARGIN sets the margin width in pixels (default is 10).

Example: crop('C:\MATLAB7\toolbox\matlab\demos\html\cruller_01.png',1)

Requirements: your FIND must allow the 'last' option (version 7+?)

引用格式

Andrew Bliss (2024). crop whitespace from an image (https://www.mathworks.com/matlabcentral/fileexchange/20427-crop-whitespace-from-an-image), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R14SP1
兼容任何版本
平台兼容性
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.2.0.0

I improved the input checks and comments. Code now handles transparency in .png files. MARGIN is now an input.

1.0.0.0