Byte encoding utilities

版本 1.1.0.0 (8.3 KB) 作者: Kota Yamaguchi
Matlab utilities to encode/decode Base64 string and GZIP bytes.
2.8K 次下载
更新时间 2013/1/4

查看许可证

Matlab encoding utilities
=========================

Matlab utilities to encode/decode a byte sequence. The package supports the
following features.

* Base64 encode
* ZLIB compression
* GZIP compression
* Image compression (image processing toolbox required)

The package internally uses JAVA functions. JAVA must be enabled in Matlab.

Usage
-----

### Base64 encode

Use `base64encode` and `base64decode` for encoding/decoding.

>> x = 'foo bar';
>> z = base64encode(x)

z =

Zm9vIGJhcg==

>> x2 = char(base64decode(z))

x2 =

foo bar

### ZLIB compression

Use `zlibencode` and `zlibdecode`.

>> x = zeros(1, 1000, 'uint8');
>> z = zlibencode(x);
>> whos
Name Size Bytes Class Attributes

x 1x1000 1000 uint8
z 1x17 17 uint8

>> x == zlibdecode(z)

### GZIP compression

Use `gzipencode` and `gzipdecode`.

>> x = zeros(1, 1000, 'uint8');
>> z = gzipencode(x);
>> whos
Name Size Bytes Class Attributes

x 1x1000 1000 uint8
z 1x29 29 uint8

>> x == gzipdecode(z)

### Image compression

Use `imencode` and `imdecode`. Both functions take image format in the second
argument. See `imformats` for the list of available formats on the platform.

>> im = imread('cat.jpg');
>> z = imencode(im, 'jpg');
>> whos
Name Size Bytes Class Attributes

im 500x375x3 562500 uint8
z 1x24653 24653 uint8
>> im2 = imdecode(z, 'jpg');

引用格式

Kota Yamaguchi (2024). Byte encoding utilities (https://www.mathworks.com/matlabcentral/fileexchange/39526-byte-encoding-utilities), MATLAB Central File Exchange. 检索时间: .

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

Community Treasure Hunt

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

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

Fixed an error in base64decode; Added ZLIB compression, image compression;

1.0.0.0