makethumbdir

版本 1.0.0.0 (2.8 KB) 作者: Brett Shoelson
Create thumbnails for all MATLAB-writeable image types of a given extension in a selected directory.
4.2K 次下载
更新时间 2003/2/3

查看许可证

编者注: This file was a File Exchange Pick of the Week

Syntax: MAKETHUMBDIR(MAXSIZE, KEEPFRAC)

The user is prompted to select any image in the folder to be "thumbnailed." The mfile will then create thumbnails for all MATLAB-writeable image types having the same extension as the selected image and residing in the selected directory, and store them in a thumbnail folder within that directory. Thumbnails will have the same name as their parent images, although their paths will necessarily be different.

ARGUMENTS:

Two OPTIONAL ARGUMENTS, as follows:

MAXSIZE is the maximum size of the thumbnail, in kB. The default value of MAXSIZE is 32 (kB).Note that some image writing algorithms produce images that are further compressed; maxsize is a target for the number of bytes in an uncompressed version of the thumbnail image; thumbnails will not be larger than maxsize, but they may be considerably smaller.

KEEPFRAC (which, if it is provided, must be a positive integer greater than 1) determines the number of rows and columns maintained from the original image. A thumbnail for a "2-dimensional" (eg., indexed or grayscale) image should approach 1/keepfrac^2 times the size of its parent image, or 3/keepfrac^2 for "3-dimensional" (eg., truecolor or RGB) images. For example, if the value is set to 8, a thumbnail for a grayscale image will approach 1/64th the size of the parent image.

BY DEFAULT, the value is set dynamically for each parent image to target a thumbnail that is no larger than MAXSIZE kB. However, if KEEPFRAC is provided, MAXSIZE is ignored. The program supports all image file types writeable by MATLAB:

JPEG, TIFF, BMP, PNG, HDF, PCX, or XWD.

The user will be presented with a uigetfile dialog box in which to select a single image to thumbnail. All images of the same extension/type in the same folder will be similarly thumbnailed.

EXAMPLE: makethumbdir %Creates a default series of thumbnails of maximum 32 kB.

makethumbdir(64) %May be of higher resolution, with images possibly ranging up to 64 kB.
makethumbdir([],4) %Writes thumbnails comprising every 4th row and column
makethumbdir(64,4) %Writes thumbnails comprising every 4th row and column

(first argument is ignored)

Written by Brett Shoelson (shoelson@helix.nih.gov; shoelson@hotmail.com).
Last update 1/31/03.
Tested under R12.1 and R13

引用格式

Brett Shoelson (2024). makethumbdir (https://www.mathworks.com/matlabcentral/fileexchange/2983-makethumbdir), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R13
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 File Operations 的更多信息

Community Treasure Hunt

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

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