| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
<!DOCTYPE html> |
| 5 |
<html lang="en" data-bs-theme="dark"> |
| 6 |
<head> |
| 7 |
<meta charset="utf-8" /> |
| 8 |
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" /> |
| 9 |
|
| 10 |
|
| 11 |
<title>ImageMagick | Multispectral Imagery</title> |
| 12 |
<meta name="description" content="ImageMagick is a powerful open-source software suite for creating, editing, converting, and manipulating images in over 200 formats. Ideal for developers, designers, and researchers." /> |
| 13 |
|
| 14 |
|
| 15 |
<link rel="canonical" href="multispectral-imagery.html" /> |
| 16 |
|
| 17 |
|
| 18 |
<meta name="robots" content="index, follow" /> |
| 19 |
|
| 20 |
|
| 21 |
<meta name="theme-color" content="#000000" /> |
| 22 |
|
| 23 |
|
| 24 |
<meta name="google-site-verification" content="_bMOCDpkx9ZAzBwb2kF3PRHbfUUdFj2uO8Jd1AXArz4" /> |
| 25 |
|
| 26 |
|
| 27 |
<link rel="shortcut icon" href="../images/wand.png" type="images/png" /> |
| 28 |
<link rel="apple-touch-icon" href="../images/wand.png" type="images/png" /> |
| 29 |
|
| 30 |
|
| 31 |
<link rel="preconnect" href="../index.html" /> |
| 32 |
|
| 33 |
|
| 34 |
<link rel="preload" href="assets/bootstrap.min.css" as="style" crossorigin="anonymous" /> |
| 35 |
<link rel="stylesheet" href="assets/bootstrap.min.css" /> |
| 36 |
|
| 37 |
|
| 38 |
<style> |
| 39 |
html { |
| 40 |
scroll-padding-top: 70px; |
| 41 |
} |
| 42 |
</style> |
| 43 |
|
| 44 |
|
| 45 |
<meta property="og:title" content="ImageMagick | Multispectral Imagery" /> |
| 46 |
<meta property="og:description" content="ImageMagick is a powerful open-source software suite for creating, editing, converting, and manipulating images in over 200 formats. Ideal for developers, designers, and researchers." /> |
| 47 |
<meta property="og:image" content="../images/logo.png" /> |
| 48 |
<meta property="og:logo" content="../images/logo.png" /> |
| 49 |
<meta property="og:url" content="../www/multispectral-imagery.html" /> |
| 50 |
<meta property="og:type" content="website" /> |
| 51 |
<meta property="og:site_name" content="ImageMagick" /> |
| 52 |
<meta property="og:locale" content="en_us" /> |
| 53 |
|
| 54 |
|
| 55 |
<meta name="twitter:card" content="summary_large_image" /> |
| 56 |
<meta name="twitter:site" content="@imagemagick" /> |
| 57 |
<meta name="twitter:creator" content="@imagemagick" /> |
| 58 |
<meta name="twitter:title" content="ImageMagick | Multispectral Imagery" /> |
| 59 |
<meta name="twitter:description" content="ImageMagick is a powerful open-source software suite for creating, editing, converting, and manipulating images in over 200 formats. Ideal for developers, designers, and researchers." /> |
| 60 |
<meta name="twitter:image" content="../images/logo.png" /> |
| 61 |
<meta name="twitter:image:alt" content="ImageMagick logo and tag line" /> |
| 62 |
|
| 63 |
|
| 64 |
<script type="application/ld+json"> |
| 65 |
{ |
| 66 |
"@context": "https://schema.org", |
| 67 |
"@type": "SoftwareApplication", |
| 68 |
"name": "ImageMagick", |
| 69 |
"url": "../www/multispectral-imagery.html", |
| 70 |
"image": "../images/logo.png", |
| 71 |
"description": "ImageMagick is a powerful open-source software suite for creating, editing, converting, and manipulating images in over 200 formats. Ideal for developers, designers, and researchers.", |
| 72 |
"applicationCategory": "Multimedia", |
| 73 |
"operatingSystem": "Windows, macOS, Linux, Unix", |
| 74 |
"softwareVersion": "7.1.2-1", |
| 75 |
"license": "../www/license.html", |
| 76 |
"creator": { |
| 77 |
"@type": "Organization", |
| 78 |
"name": "ImageMagick Studio LLC", |
| 79 |
"url": "https://imagemagick.org" |
| 80 |
}, |
| 81 |
"keywords": [ |
| 82 |
"Multispectral Imagery", |
| 83 |
"image processing software", |
| 84 |
"image conversion tool", |
| 85 |
"batch image editing", |
| 86 |
"open-source image editor", |
| 87 |
"ImageMagick command-line", |
| 88 |
"resize images ImageMagick", |
| 89 |
"crop and rotate images", |
| 90 |
"ImageMagick tutorial", |
| 91 |
"ImageMagick automation", |
| 92 |
"ImageMagick for developers", |
| 93 |
"ImageMagick CLI", |
| 94 |
"ImageMagick filters and effects", |
| 95 |
"ImageMagick scripting", |
| 96 |
"ImageMagick API integration" |
| 97 |
], |
| 98 |
"sameAs": [ |
| 99 |
"https://github.com/ImageMagick", |
| 100 |
"https://x.com/imagemagick" |
| 101 |
], |
| 102 |
"offers": { |
| 103 |
"@type": "Offer", |
| 104 |
"price": "0.00", |
| 105 |
"priceCurrency": "USD" |
| 106 |
} |
| 107 |
} |
| 108 |
</script> |
| 109 |
|
| 110 |
</head> |
| 111 |
<body> |
| 112 |
<script> |
| 113 |
function setTheme(theme) { |
| 114 |
localStorage.setItem('theme', theme); |
| 115 |
updateThemeIcon(theme); |
| 116 |
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? getSystemTheme() : theme); |
| 117 |
} |
| 118 |
function getSystemTheme() { |
| 119 |
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'; |
| 120 |
} |
| 121 |
function updateThemeIcon(theme) { |
| 122 |
const iconMap = { |
| 123 |
light: '☀️', |
| 124 |
dark: '🌙', |
| 125 |
auto: '🌓' |
| 126 |
}; |
| 127 |
document.getElementById('currentThemeIcon').textContent = iconMap[theme] || '🌓'; |
| 128 |
} |
| 129 |
document.addEventListener('DOMContentLoaded', () => { |
| 130 |
const savedTheme = localStorage.getItem('theme') || 'auto'; |
| 131 |
setTheme(savedTheme); |
| 132 |
}); |
| 133 |
</script> |
| 134 |
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top"> |
| 135 |
<div class="container-fluid"> |
| 136 |
<a class="navbar-brand fw-bold" href="../index.html" title="$meta->sitename;"> |
| 137 |
ImageMagick </a> |
| 138 |
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#magick-navbars" aria-controls="magick-navbars" aria-expanded="false" aria-label="Toggle navigation"> |
| 139 |
<span class="navbar-toggler-icon"></span> |
| 140 |
</button> |
| 141 |
|
| 142 |
<div class="collapse navbar-collapse" id="magick-navbars"> |
| 143 |
<ul class="navbar-nav me-auto"> |
| 144 |
<li class="nav-item"> |
| 145 |
<a class="nav-link " href="download.html">Download</a> |
| 146 |
</li> |
| 147 |
<li class="nav-item"> |
| 148 |
<a class="nav-link " href="../www/command-line-tools.html">Tools</a> |
| 149 |
</li> |
| 150 |
<li class="nav-item"> |
| 151 |
<a class="nav-link " href="command-line-processing.html">CLI</a> |
| 152 |
</li> |
| 153 |
<li class="nav-item"> |
| 154 |
<a class="nav-link " href="develop.html">Develop</a> |
| 155 |
</li> |
| 156 |
<li class="nav-item"> |
| 157 |
<a class="nav-link" rel="noopener" target="_blank" href="https://github.com/ImageMagick/ImageMagick/discussions">Community</a> |
| 158 |
</li> |
| 159 |
<li class="nav-item ms-4"> |
| 160 |
<iframe src="https://github.com/sponsors/ImageMagick/button" title="Sponsor ImageMagick" height="35" width="107" style="border: 0;"></iframe> |
| 161 |
</li> |
| 162 |
</ul> |
| 163 |
<ul class="navbar-nav ms-auto"> |
| 164 |
<li class="nav-item dropdown"> |
| •165 |
</li> |
| 166 |
<li class="nav-item dropdown ms-2"> |
| 167 |
<a class="nav-link dropdown-toggle" href="#" id="themeDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false"> |
| 168 |
<span id="currentThemeIcon">🌓</span> |
| 169 |
</a> |
| 170 |
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="themeDropdown"> |
| 171 |
<li><a class="dropdown-item" href="#" onclick="setTheme('light')">☀️ Light</a></li> |
| 172 |
<li><a class="dropdown-item" href="#" onclick="setTheme('dark')">🌙 Dark</a></li> |
| 173 |
<li><a class="dropdown-item" href="#" onclick="setTheme('auto')">🌓 Auto</a></li> |
| 174 |
</ul> |
| 175 |
</li> |
| 176 |
</ul> |
| 177 |
</div> |
| 178 |
</div> |
| 179 |
</nav> |
| 180 |
|
| 181 |
<div class="col-lg-8 mx-auto text-body-secondary pt-5 pt-lg-5"> |
| 182 |
<header class="d-flex align-items-center pb-3 mb-5 border-bottom"> |
| 183 |
<div class="mt-3 ms-3"> |
| 184 |
<a href="../index.html" class="text-decoration-none"> |
| 185 |
<h1 class="fs-2 mb-1">Multispectral Imagery</h1> |
| 186 |
</a> |
| 187 |
<h2 class="fs-5 text-muted">ImageMagick</h2> |
| 188 |
</div> |
| 189 |
</header> |
| 190 |
|
| 191 |
<main class="container"> |
| 192 |
<div> |
| 193 |
<p class="lead">Multispectral imagery refers to images that are captured using multiple bands of the electromagnetic spectrum, beyond just the visible light spectrum. This means that they capture data across a wider range of wavelengths, from ultraviolet to infrared.</p> |
| 194 |
<p>By capturing data across multiple spectral bands, multispectral imagery can provide additional information about the objects or scenes being imaged, such as their composition, temperature, and vegetation health. This information can be used for a wide range of applications, including agriculture, environmental monitoring, disaster response, and military surveillance.</p> |
| 195 |
<p>Multispectral imagery is often captured using specialized sensors on satellites, drones, or aircraft. The data is then processed using specialized software to create images that display the information captured in each spectral band.</p> |
| 196 |
<p>Overall, multispectral imagery provides a powerful tool for analyzing and understanding the world around us, allowing us to gain insights that would be impossible to obtain using visible light imagery alone.</p> |
| 197 |
<h4>Multispectral Support in ImageMagick</h4> |
| 198 |
<p>ImageMagick supports multispectral images where all channels have the same dimensions and number of pixels as the original image. However, not all image formats support multispectral images. PSD, TIFF, MIFF, MPC, and <a href="http://im.snibgo.com/fmttxt.htm">FTXT</a> have full support for multispectral images up to 31 bands with 21 meta channels. If you build ImageMagick with the configure script <samp>--enable-64bit-channel-masks</samp> option, you can process 62 band multispectral images with up to 52 meta channels.</p> |
| 199 |
<p>We call image channels beyond the standard RGB(A) or CMYK(A) channels, "meta" channels. We label them as "meta", "meta1", "meta2", etc.. Meta channels are treated the same as any other channel meaning they can be read, written, and operated upon-- e.g., resized, gamma adjusted, etc.</p> |
| 200 |
<h5>Create a Multispectral Image</h5> |
| 201 |
<p>Begin with a multispectral image, typically in the TIFF or PSD format. If you don't have one, you can create your own. In our example, we create a single CMYK pixel with two meta channels. Stuff this in a file titled <code>multiMeta.txt</code>:</p> |
| 202 |
<pre class="p-3 mb-2 text-body-secondary bg-body-tertiary"><samp>0,0: 10,20,30,40,50,60</samp></pre> |
| 203 |
<p>Let's convert that to the TIFF image format:</p> |
| 204 |
<pre class="p-3 mb-2 text-body-secondary bg-body-tertiary"><samp>$ magick -size 1x1 -colorspace CMYK -define ftxt:format="\x,\y:\c\n" -define ftxt:hasalpha=false -define ftxt:nummeta=2 ftxt:multiMeta.txt multiMeta.tif</samp></pre> |
| •205 |
<p>Let confirm that worked as expected:</p> |
| 206 |
<pre class="pre-scrollable p-3 mb-2 text-body-secondary bg-body-tertiary"><samp>$ identify -verbose multiMeta.tif |
| 207 |
Image: |
| 208 |
Filename: multiMeta.tif |
| 209 |
Permissions: rw------- |
| 210 |
Format: TIFF (Tagged Image File Format) |
| 211 |
Mime type: images/tiff |
| 212 |
Class: DirectClass |
| 213 |
Geometry: 1x1+0+0 |
| 214 |
Units: PixelsPerInch |
| 215 |
Colorspace: CMYK |
| 216 |
Type: ColorSeparation |
| 217 |
Endianness: LSB |
| 218 |
Depth: 16-bit |
| 219 |
Channels: 6.2 |
| 220 |
Channel depth: |
| 221 |
Cyan: 16-bit |
| 222 |
Magenta: 16-bit |
| 223 |
Yellow: 16-bit |
| 224 |
Black: 16-bit |
| 225 |
Meta channel[0]: 16-bit |
| 226 |
Meta channel[1]: 16-bit |
| 227 |
Channel statistics: |
| 228 |
Pixels: 1 |
| 229 |
Cyan: |
| 230 |
min: 10 (0.00015259) |
| 231 |
max: 10 (0.00015259) |
| 232 |
mean: 10 (0.00015259) |
| 233 |
median: 10 (0.00015259) |
| 234 |
standard deviation: 0 (0) |
| 235 |
kurtosis: -3 |
| 236 |
skewness: 0 |
| 237 |
entropy: 0 |
| 238 |
Magenta: |
| 239 |
min: 20 (0.00030518) |
| 240 |
max: 20 (0.00030518) |
| 241 |
mean: 20 (0.00030518) |
| 242 |
median: 20 (0.00030518) |
| 243 |
standard deviation: 0 (0) |
| 244 |
kurtosis: -3 |
| 245 |
skewness: 0 |
| 246 |
entropy: 0 |
| 247 |
Yellow: |
| 248 |
min: 30 (0.000457771) |
| 249 |
max: 30 (0.000457771) |
| 250 |
mean: 30 (0.000457771) |
| 251 |
median: 30 (0.000457771) |
| 252 |
standard deviation: 0 (0) |
| 253 |
kurtosis: -3 |
| 254 |
skewness: 0 |
| 255 |
entropy: 0 |
| 256 |
Black: |
| 257 |
min: 40 (0.000610361) |
| 258 |
max: 40 (0.000610361) |
| 259 |
mean: 40 (0.000610361) |
| 260 |
median: 40 (0.000610361) |
| 261 |
standard deviation: 0 (0) |
| 262 |
kurtosis: -3 |
| 263 |
skewness: 0 |
| 264 |
entropy: 0 |
| 265 |
Meta channel[0]: |
| 266 |
min: 50 (0.000762951) |
| 267 |
max: 50 (0.000762951) |
| 268 |
mean: 50 (0.000762951) |
| 269 |
median: 50 (0.000762951) |
| 270 |
standard deviation: 0 (0) |
| 271 |
kurtosis: -3 |
| 272 |
skewness: 0 |
| 273 |
entropy: 0 |
| 274 |
Meta channel[1]: |
| 275 |
min: 60 (0.000915541) |
| 276 |
max: 60 (0.000915541) |
| 277 |
mean: 60 (0.000915541) |
| 278 |
median: 60 (0.000915541) |
| 279 |
standard deviation: 0 (0) |
| 280 |
kurtosis: -3 |
| 281 |
skewness: 0 |
| 282 |
entropy: 0 |
| 283 |
Image statistics: |
| 284 |
Overall: |
| 285 |
min: 10 (0.00015259) |
| 286 |
max: 60 (0.000915541) |
| 287 |
mean: 35 (0.000534066) |
| 288 |
median: 35 (0.000534066) |
| 289 |
standard deviation: 0 (0) |
| 290 |
kurtosis: -1.79762 |
| 291 |
skewness: 4.44476e-15 |
| 292 |
entropy: 0 |
| 293 |
Total ink density: 0.15259% |
| 294 |
Colors: 1 |
| 295 |
Histogram: |
| 296 |
1: (10,20,30,40) #000A0014001E0028 cmyk(0.0389105,0.077821,0.116732,0.155642) |
| 297 |
Rendering intent: Perceptual |
| 298 |
Gamma: 0.454545 |
| 299 |
Chromaticity: |
| 300 |
red primary: (0.64,0.33) |
| 301 |
green primary: (0.3,0.6) |
| 302 |
blue primary: (0.15,0.06) |
| 303 |
white point: (0.3127,0.329) |
| 304 |
Matte color: grey74 |
| 305 |
Background color: white |
| 306 |
Border color: srgb(223,223,223) |
| 307 |
Transparent color: black |
| 308 |
Interlace: None |
| 309 |
Intensity: Undefined |
| 310 |
Compose: Over |
| 311 |
Page geometry: 1x1+0+0 |
| 312 |
Dispose: Undefined |
| 313 |
Iterations: 0 |
| 314 |
Compression: None |
| 315 |
Orientation: TopLeft |
| 316 |
Properties: |
| 317 |
date:create: 2023-03-12T11:38:42+00:00 |
| 318 |
date:modify: 2023-03-12T11:38:42+00:00 |
| 319 |
date:timestamp: 2023-03-12T11:38:56+00:00 |
| 320 |
signature: c51848f16d296f7c95be14404cc582f49db6fd33f31b544a2ce10e440b3747b3 |
| 321 |
tiff:alpha: unspecified |
| 322 |
tiff:endian: lsb |
| 323 |
tiff:photometric: separated |
| 324 |
tiff:rows-per-strip: 1 |
| 325 |
Artifacts: |
| 326 |
verbose: true |
| 327 |
Tainted: False |
| 328 |
Filesize: 306B |
| 329 |
Number pixels: 1 |
| 330 |
</samp></pre> |
| •331 |
<p>Notice the channel depth and statistics associated with the two meta channels.</p> |
| 332 |
<h5>Working with Multispectral Images</h5> |
| •333 |
<p>Meta channels are treated the same as any other channel meaning they can be read, written, and operated upon-- e.g., resized, gamma adjusted, etc.. Here, we replace the first channel with the contents of the meta channel:</p> |
| 334 |
<pre class="p-3 mb-2 text-body-secondary bg-body-tertiary"><samp>magick multiMeta.tif -channel-fx 'meta1=>cyan' multiMeta-1.tif</samp></pre> |
| •335 |
<p>The original cyan channel has an intensity of 10. It's now, per the channel FX instructions, 50.</p> |
| 336 |
<p>And in this example, we create two meta channels:</p> |
| 337 |
<pre class="p-3 mb-2 text-body-secondary bg-body-tertiary"><samp>magick lena.png \( mandril3.jpg -colorspace gray \) -channel-fx '| gray=>meta' \( zelda1.jpg -colorspace gray \) -channel-fx '| gray=>meta1' meta.tif</samp></pre> |
| 338 |
<p>In this example, we blend two meta channels into a single alpha channel:</p> |
| 339 |
<pre class="p-3 mb-2 text-body-secondary bg-body-tertiary"><samp>magick in.tiff -alpha opaque \( +clone -set colorspace sRGB -channel-fx "meta0=>red meta1=>green" \) -channel A -fx "(v.r+v.g)/2" +channel out.tiff</samp></pre> |
| 340 |
<br/> |
| 341 |
<h5>Writing Multispectral Images</h5> |
| 342 |
<p>You can preserve multispectral images by writing them to a format that supports meta channels such as TIFF or PSD. If you write to other image formats that do not support multisprectal images, the channels are not preserved and instead lost-- e.g., PNG. In this example, we read, resize, and write a multispectral image:</p> |
| 343 |
<pre class="p-3 mb-2 text-body-secondary bg-body-tertiary"><samp>magick multiMeta.tif -resize 50% resizedMeta.tif</samp></pre> |
| 344 |
</div> |
| 345 |
</main> |
| 346 |
<footer class="text-center pt-5 my-5 text-body-secondary border-top"> |
| 347 |
<div class="container-fluid"> |
| 348 |
<a href="security-policy.html">Security</a> • |
| 349 |
<a href="news.html">News</a> |
| 350 |
|
| 351 |
<a href="#"><img class="d-inline" id="wand" alt="And Now a Touch of Magick" width="16" height="16" src="../images/wand.ico" /></a> |
| 352 |
|
| 353 |
<a href="../www/links.html">Related</a> • |
| 354 |
<a href="../www/sitemap.html">Sitemap</a> |
| •355 |
<br /> |
| 356 |
<a href="../www/support.html">Sponsor</a> • |
| 357 |
<a href="../www/cite.html">Cite</a> • |
| 358 |
<a href="http://pgp.mit.edu/pks/lookup?op=get&search=0x89AB63D48277377A">Public Key</a> • |
| 359 |
<a href="../www/../www/https://imagemagick.org/script/contact.php">Contact Us</a> |
| •360 |
<br /> |
| 361 |
<a href="https://github.com/imagemagick/imagemagick" rel="noopener" target="_blank" aria-label="GitHub"><svg xmlns="http://www.w3.org/2000/svg" class="navbar-nav-svg" viewBox="0 0 512 499.36" width="2%" height="2%" role="img" focusable="false"><title>GitHub</title><path fill="currentColor" fill-rule="evenodd" d="M256 0C114.64 0 0 114.61 0 256c0 113.09 73.34 209 175.08 242.9 12.8 2.35 17.47-5.56 17.47-12.34 0-6.08-.22-22.18-.35-43.54-71.2 15.49-86.2-34.34-86.2-34.34-11.64-29.57-28.42-37.45-28.42-37.45-23.27-15.84 1.73-15.55 1.73-15.55 25.69 1.81 39.21 26.38 39.21 26.38 22.84 39.12 59.92 27.82 74.5 21.27 2.33-16.54 8.94-27.82 16.25-34.22-56.84-6.43-116.6-28.43-116.6-126.49 0-27.95 10-50.8 26.35-68.69-2.63-6.48-11.42-32.5 2.51-67.75 0 0 21.49-6.88 70.4 26.24a242.65 242.65 0 0 1 128.18 0c48.87-33.13 70.33-26.24 70.33-26.24 14 35.25 5.18 61.27 2.55 67.75 16.41 17.9 26.31 40.75 26.31 68.69 0 98.35-59.85 120-116.88 126.32 9.19 7.9 17.38 23.53 17.38 47.41 0 34.22-.31 61.83-.31 70.23 0 6.85 4.61 14.81 17.6 12.31C438.72 464.97 512 369.08 512 256.02 512 114.62 397.37 0 256 0z"/></svg></a> • |
| 362 |
<a href="https://twitter.com/imagemagick" rel="noopener" target="_blank" aria-label="Twitter"><svg xmlns="http://www.w3.org/2000/svg" class="navbar-nav-svg" viewBox="0 0 300 300" width="2%" height="2%" role="img" focusable="false"><title>Twitter</title><path d="M178.57 127.15 290.27 0h-26.46l-97.03 110.38L89.34 0H0l117.13 166.93L0 300.25h26.46l102.4-116.59 81.8 116.59h89.34M36.01 19.54H76.66l187.13 262.13h-40.66"/></svg></a> |
| •363 |
<br /> |
| 364 |
<small>Copyright © 1999 ImageMagick Studio LLC</small> |
| 365 |
</div> |
| 366 |
</footer> |
| 367 |
</div> |
| 368 |
|
| 369 |
|
| 370 |
<script src="assets/bootstrap.bundle.min.js" ></script> |
| 371 |
</body> |
| 372 |
</html> |