github.com/kaydxh/golang@v0.0.131/pkg/gocv/cgo/third_path/graphics-magick/share/doc/GraphicsMagick/www/motion-picture.html (about)

     1  <?xml version="1.0" encoding="utf-8" ?>
     2  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     3  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
     4  <head>
     5  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     6  <meta name="generator" content="Docutils 0.15.2: http://docutils.sourceforge.net/" />
     7  <title>GraphicsMagick Cineon and SMTPE DPX Support</title>
     8  <meta content="Describes GraphicsMagick's support for Cineon and SMPTE DPX formats. " name="description" />
     9  <meta content="GraphicsMagick, Cineon, DPX, SMPTE 268M, Motion Picture" name="keywords" />
    10  <link rel="stylesheet" href="docutils-articles.css" type="text/css" />
    11  </head>
    12  <body>
    13  
    14  <div class="banner">
    15  <img src="images/gm-107x76.png" alt="GraphicMagick logo" width="107" height="76" />
    16  <span class="title">GraphicsMagick</span>
    17  <form action="http://www.google.com/search">
    18  	<input type="hidden" name="domains" value="www.graphicsmagick.org" />
    19  	<input type="hidden" name="sitesearch" value="www.graphicsmagick.org" />
    20      <span class="nowrap"><input type="text" name="q" size="25" maxlength="255" />&nbsp;<input type="submit" name="sa" value="Search" /></span>
    21  </form>
    22  </div>
    23  
    24  <div class="navmenu">
    25  <ul>
    26  <li><a href="index.html">Home</a></li>
    27  <li><a href="project.html">Project</a></li>
    28  <li><a href="download.html">Download</a></li>
    29  <li><a href="README.html">Install</a></li>
    30  <li><a href="Hg.html">Source</a></li>
    31  <li><a href="NEWS.html">News</a> </li>
    32  <li><a href="utilities.html">Utilities</a></li>
    33  <li><a href="programming.html">Programming</a></li>
    34  <li><a href="reference.html">Reference</a></li>
    35  </ul>
    36  </div>
    37  <div class="document" id="graphicsmagick-cineon-and-smtpe-dpx-support">
    38  <h1 class="title">GraphicsMagick Cineon and SMTPE DPX Support</h1>
    39  
    40  <!-- -*- mode: rst -*- -->
    41  <!-- This text is in reStucturedText format, so it may look a bit odd. -->
    42  <!-- See http://docutils.sourceforge.net/rst.html for details. -->
    43  <div class="contents local topic" id="contents">
    44  <ul class="simple">
    45  <li><a class="reference internal" href="#introduction" id="id1">Introduction</a></li>
    46  <li><a class="reference internal" href="#applications" id="id2">Applications</a></li>
    47  <li><a class="reference internal" href="#dpx-features" id="id3">DPX features</a><ul>
    48  <li><a class="reference internal" href="#basic" id="id4">Basic</a></li>
    49  <li><a class="reference internal" href="#colorspaces" id="id5">Colorspaces</a></li>
    50  <li><a class="reference internal" href="#storage" id="id6">Storage</a></li>
    51  <li><a class="reference internal" href="#yet-to-be-supported" id="id7">Yet to be supported</a></li>
    52  </ul>
    53  </li>
    54  <li><a class="reference internal" href="#using-graphicsmagick" id="id8">Using GraphicsMagick</a><ul>
    55  <li><a class="reference internal" href="#image-resize" id="id9">Image Resize</a></li>
    56  <li><a class="reference internal" href="#annotate-image" id="id10">Annotate Image</a></li>
    57  <li><a class="reference internal" href="#colorspace-transformation" id="id11">Colorspace Transformation</a></li>
    58  <li><a class="reference internal" href="#modifying-an-image-in-place" id="id12">Modifying An Image In-Place</a></li>
    59  <li><a class="reference internal" href="#creating-a-contact-sheet" id="id13">Creating A Contact Sheet</a></li>
    60  <li><a class="reference internal" href="#animating-a-sequence" id="id14">Animating A Sequence</a></li>
    61  <li><a class="reference internal" href="#displaying-one-image-frame" id="id15">Displaying One Image Frame</a></li>
    62  <li><a class="reference internal" href="#viewing-a-sequence" id="id16">Viewing A Sequence</a></li>
    63  <li><a class="reference internal" href="#using-the-batch-capability" id="id17">Using the Batch capability</a></li>
    64  </ul>
    65  </li>
    66  <li><a class="reference internal" href="#options-and-attributes" id="id18">Options And Attributes</a><ul>
    67  <li><a class="reference internal" href="#command-options" id="id19">Command options</a></li>
    68  <li><a class="reference internal" href="#dpx-attributes" id="id20">DPX Attributes</a></li>
    69  </ul>
    70  </li>
    71  </ul>
    72  </div>
    73  <div class="section" id="introduction">
    74  <h1><a class="toc-backref" href="#id1">Introduction</a></h1>
    75  <p>GraphicsMagick supports legacy Legacy 10-bit Kodak Cineon format as
    76  well as high-grade support for <a class="reference external" href="http://www.smpte.org/">SMPTE</a> DPX Version 2.0 (<a class="reference external" href="http://www.smpte.org/">SMPTE</a>
    77  268M-2003).  SMPTE DPX RGB and YCbCr colorspaces are supported.  The
    78  DPX implementation supports 8, 10, 12, and 16 bits/sample and any
    79  arbitrary image pixel size.  The Cineon implementation supports 8 and
    80  10 bits/sample.</p>
    81  <p>Film images are usually captured at <em>2K</em> resolution (82 pixels/mm),
    82  <em>4K</em> resolution (164 pixels/mm), or even <em>8K</em> resolution (328
    83  pixels/mm), where the actual resolution values approximate the
    84  horizontal dimension of the image. A table of <a class="reference external" href="http://www.surrealroad.com/digital/index.php/archives/2005/standard-data-resolutions/">typical pixel
    85  resolutions</a> for various film sizes may be found on the <a class="reference external" href="http://blog.surrealroad.com//">Surreal
    86  Road</a> site (table reproduced here for convenience). File sizes may be
    87  quite large and range in size from 8MB to as much as 180MB. The common
    88  10-bit <em>2K</em> format consumes 12MB of disk while a 10-bit <em>4K</em> scan
    89  consumes 50MB of disk.</p>
    90  <table border="1" class="docutils">
    91  <caption>Standard data resolutions</caption>
    92  <colgroup>
    93  <col width="57%" />
    94  <col width="13%" />
    95  <col width="18%" />
    96  <col width="13%" />
    97  </colgroup>
    98  <thead valign="bottom">
    99  <tr><th class="head">Format</th>
   100  <th class="head">Picture
   101  aspect
   102  ratio</th>
   103  <th class="head">Standard
   104  pixel
   105  resolution</th>
   106  <th class="head">Pixel
   107  aspect
   108  ratio</th>
   109  </tr>
   110  </thead>
   111  <tbody valign="top">
   112  <tr><td>Apple iPod video</td>
   113  <td class="decimal">1.33</td>
   114  <td>320×240</td>
   115  <td class="decimal">1.0</td>
   116  </tr>
   117  <tr><td>Apple iPhone video</td>
   118  <td class="decimal">1.5</td>
   119  <td>480×320</td>
   120  <td class="decimal">1.0</td>
   121  </tr>
   122  <tr><td>Sony PlayStationPortable</td>
   123  <td class="decimal">1.76</td>
   124  <td>480×272</td>
   125  <td class="decimal">1.0</td>
   126  </tr>
   127  <tr><td>SD video (PAL, DV)</td>
   128  <td class="decimal">1.33</td>
   129  <td>720×576</td>
   130  <td class="decimal">1.067</td>
   131  </tr>
   132  <tr><td>SD video (NTSC, DV)</td>
   133  <td class="decimal">1.33</td>
   134  <td>720×486</td>
   135  <td class="decimal">0.9</td>
   136  </tr>
   137  <tr><td>SD video (PAL, square pixels)</td>
   138  <td class="decimal">1.33</td>
   139  <td>768×576</td>
   140  <td class="decimal">1.0</td>
   141  </tr>
   142  <tr><td>SD video (NTSC, square pixels)</td>
   143  <td class="decimal">1.33</td>
   144  <td>648×486</td>
   145  <td class="decimal">1.0</td>
   146  </tr>
   147  <tr><td>DVD video (NTSC, 4:3)</td>
   148  <td class="decimal">1.33</td>
   149  <td>720×480</td>
   150  <td class="decimal">0.9</td>
   151  </tr>
   152  <tr><td>DVD video (PAL, 4:3)</td>
   153  <td class="decimal">1.33</td>
   154  <td>720×576</td>
   155  <td class="decimal">1.067</td>
   156  </tr>
   157  <tr><td>DVD video (NTSC, 16:9)</td>
   158  <td class="decimal">1.78</td>
   159  <td>720×480</td>
   160  <td class="decimal">1.185</td>
   161  </tr>
   162  <tr><td>DVD video (PAL, 16:9)</td>
   163  <td class="decimal">1.78</td>
   164  <td>720×576</td>
   165  <td class="decimal">1.69</td>
   166  </tr>
   167  <tr><td>Blu-ray</td>
   168  <td class="decimal">1.78</td>
   169  <td>1920×1080</td>
   170  <td class="decimal">1.0</td>
   171  </tr>
   172  <tr><td>HD video &#64;720</td>
   173  <td class="decimal">1.78</td>
   174  <td>1280×720</td>
   175  <td class="decimal">1.0</td>
   176  </tr>
   177  <tr><td>HD video &#64;1080 (certain types)</td>
   178  <td class="decimal">1.78</td>
   179  <td>1440×1080</td>
   180  <td class="decimal">1.33</td>
   181  </tr>
   182  <tr><td>HD video &#64;1080</td>
   183  <td class="decimal">1.78</td>
   184  <td>1920×1080</td>
   185  <td class="decimal">1.0</td>
   186  </tr>
   187  <tr><td>DVC Pro HD &#64;59.94i</td>
   188  <td class="decimal">1.78</td>
   189  <td>1280×1080</td>
   190  <td class="decimal">1.5</td>
   191  </tr>
   192  <tr><td>16mm</td>
   193  <td class="decimal">1.37</td>
   194  <td>1712×1240</td>
   195  <td class="decimal">1.00</td>
   196  </tr>
   197  <tr><td>Super-16</td>
   198  <td class="decimal">1.65</td>
   199  <td>2048×1240</td>
   200  <td class="decimal">1.00</td>
   201  </tr>
   202  <tr><td>“Academy” aperture (2k)</td>
   203  <td class="decimal">1.37</td>
   204  <td>1828×1332</td>
   205  <td class="decimal">1.00</td>
   206  </tr>
   207  <tr><td>“Academy” aperture (4k)</td>
   208  <td class="decimal">1.37</td>
   209  <td>3656×2664</td>
   210  <td class="decimal">1.00</td>
   211  </tr>
   212  <tr><td>Cinemascope (Squeezed, 2k)</td>
   213  <td class="decimal">2.35</td>
   214  <td>1828×1556</td>
   215  <td class="decimal">2.00</td>
   216  </tr>
   217  <tr><td>Cinemascope (Squeezed, 4k)</td>
   218  <td class="decimal">2.35</td>
   219  <td>3656×2664</td>
   220  <td class="decimal">2.00</td>
   221  </tr>
   222  <tr><td>Cinemascope (Unsqueezed, 2k)</td>
   223  <td class="decimal">2.35</td>
   224  <td>2048×872</td>
   225  <td class="decimal">1.00</td>
   226  </tr>
   227  <tr><td>Cinemascope (Unsqueezed, 4k)</td>
   228  <td class="decimal">2.35</td>
   229  <td>3656×1556</td>
   230  <td class="decimal">1.00</td>
   231  </tr>
   232  <tr><td>Full Aperture (2k)</td>
   233  <td class="decimal">1.33</td>
   234  <td>2048×1556</td>
   235  <td class="decimal">1.00</td>
   236  </tr>
   237  <tr><td>Full Aperture (4k)</td>
   238  <td class="decimal">1.33</td>
   239  <td>4096×3112</td>
   240  <td class="decimal">1.00</td>
   241  </tr>
   242  <tr><td>8-perf “VistaVision” (3k)</td>
   243  <td class="decimal">1.5</td>
   244  <td>3072×2048</td>
   245  <td class="decimal">1.00</td>
   246  </tr>
   247  <tr><td>8-perf “VistaVision” (6k)</td>
   248  <td class="decimal">1.5</td>
   249  <td>6144×4096</td>
   250  <td class="decimal">1.00</td>
   251  </tr>
   252  <tr><td>Red (16:9, 4k)</td>
   253  <td class="decimal">1.78</td>
   254  <td>4096×2304</td>
   255  <td class="decimal">1.00</td>
   256  </tr>
   257  <tr><td>Red (2:1, 4k)</td>
   258  <td class="decimal">2.0</td>
   259  <td>4096×2048</td>
   260  <td class="decimal">1.00</td>
   261  </tr>
   262  <tr><td>Digital Cinema (2k)</td>
   263  <td class="decimal">1.9</td>
   264  <td>2048×1080</td>
   265  <td class="decimal">1.00</td>
   266  </tr>
   267  <tr><td>Digital Cinema (4k)</td>
   268  <td class="decimal">1.9</td>
   269  <td>4096×2160</td>
   270  <td class="decimal">1.00</td>
   271  </tr>
   272  <tr><td>UHDTV (&quot;4k&quot;)</td>
   273  <td class="decimal">1.78</td>
   274  <td>3840×2160</td>
   275  <td class="decimal">1.00</td>
   276  </tr>
   277  <tr><td>UHDTV (&quot;8k&quot;)</td>
   278  <td class="decimal">1.78</td>
   279  <td>7860×4320</td>
   280  <td class="decimal">1.00</td>
   281  </tr>
   282  </tbody>
   283  </table>
   284  </div>
   285  <div class="section" id="applications">
   286  <h1><a class="toc-backref" href="#id2">Applications</a></h1>
   287  <p>The strength of GraphicsMagick versus specialized proprietary software
   288  are its cost (absolutely free!), open source availability (user is
   289  able to fix software flaws or tailor software to meet specific needs),
   290  general purpose image processing capabilities, deep image capabilities
   291  (up to 32-bits per sample), excellent performance, platform
   292  independence, lack of encumbering usage licenses, and robust
   293  implementation. Examples of areas where GraphicsMagick may be used
   294  are:</p>
   295  <blockquote>
   296  <ul class="simple">
   297  <li>View the image on a display.</li>
   298  <li>Scaling (for example, <em>4K</em> to <em>2K</em> or 1920x1080 HD with excellent quality)</li>
   299  <li>Cropping</li>
   300  <li>Rotation</li>
   301  <li>Filtering</li>
   302  <li>ICC ICM profile-based color management and transformations</li>
   303  <li>Gamma adjustment</li>
   304  <li>Color adjustment</li>
   305  <li>Conversion to grayscale</li>
   306  <li>Text annotations</li>
   307  <li>Compositions</li>
   308  <li>Drawing on images (for example drawing markers on image)</li>
   309  <li>Conversion to and from other formats (e.g. Kodak Cineon, TIFF, JPEG, SGI,
   310  Postscript, PNG, and PNM)</li>
   311  </ul>
   312  </blockquote>
   313  <p>GraphicsMagick's DPX file format support is very comprehensive. It
   314  goes beyond the DPX format support in other applications by striving
   315  to implement the complete DPX specification rather than just a few
   316  commonly used sub-formats. The capabilities of GraphicsMagick's DPX
   317  support are as follows:</p>
   318  </div>
   319  <div class="section" id="dpx-features">
   320  <h1><a class="toc-backref" href="#id3">DPX features</a></h1>
   321  <div class="section" id="basic">
   322  <h2><a class="toc-backref" href="#id4">Basic</a></h2>
   323  <blockquote>
   324  <ul class="simple">
   325  <li>Anything which can be read, can also be written.</li>
   326  <li>All DPX header information (including the user specific area) are
   327  stored as image attributes and restored when the image is written.</li>
   328  <li>Image source header information is updated appropriately.</li>
   329  </ul>
   330  </blockquote>
   331  </div>
   332  <div class="section" id="colorspaces">
   333  <h2><a class="toc-backref" href="#id5">Colorspaces</a></h2>
   334  <blockquote>
   335  <ul class="simple">
   336  <li>Linear RGB</li>
   337  <li>Cineon Log RGB (default density range = 2.048)</li>
   338  <li>Grayscale (Luma)</li>
   339  <li>Rec. 601 and Rec. 709 YCbCr (4:4:4 and 4:2:2). Below-black and
   340  above-white values are clipped.</li>
   341  </ul>
   342  </blockquote>
   343  </div>
   344  <div class="section" id="storage">
   345  <h2><a class="toc-backref" href="#id6">Storage</a></h2>
   346  <blockquote>
   347  <ul class="simple">
   348  <li>Bits per sample of 1, 8, 10, 12, and 16.</li>
   349  <li>Packed, or fill type A or B for 10/12 bits.</li>
   350  <li>All RGB-oriented element types (R, G, B, A, RGB, RGBA, ABGR).</li>
   351  <li>YCbCr</li>
   352  <li>Planar (multi-element) storage fully supported.</li>
   353  <li>Alpha may be stored in a separate element.</li>
   354  <li>Big and little endian storage.</li>
   355  </ul>
   356  </blockquote>
   357  </div>
   358  <div class="section" id="yet-to-be-supported">
   359  <h2><a class="toc-backref" href="#id7">Yet to be supported</a></h2>
   360  <blockquote>
   361  <ul class="simple">
   362  <li>Composite video.</li>
   363  <li>Floating point formats (32 and 64 bits)</li>
   364  <li>Depth channel (not supportable within GraphicsMagick).</li>
   365  <li>Studio (reduced range) YCbCr and RGB.</li>
   366  </ul>
   367  </blockquote>
   368  <p>The software is written efficiently so the performance when reading
   369  and writing files is limited by the performance of the file I/O
   370  subsystem.  The software is designed to avoid seeking while reading
   371  and writing so that files may be read and written over pipes, or via a
   372  user provided file descriptor.</p>
   373  </div>
   374  </div>
   375  <div class="section" id="using-graphicsmagick">
   376  <h1><a class="toc-backref" href="#id8">Using GraphicsMagick</a></h1>
   377  <div class="section" id="image-resize">
   378  <h2><a class="toc-backref" href="#id9">Image Resize</a></h2>
   379  <p>GraphicsMagick is easy to use. The following is an example of scaling
   380  a <em>4K</em> 16 bit scan to a <em>2K</em> <em>Academy</em> 10 bit image using the <a class="reference external" href="convert.html">convert</a>
   381  command:</p>
   382  <pre class="literal-block">
   383  gm convert 4k.dpx -resize 1828x1556 -depth 10 2k.dpx
   384  </pre>
   385  <p>The above example uses the default resizing filters which are
   386  optimized for quality, but take longer than some other filters. The
   387  <em>box</em> resize filter provides reasonably good scaling in a reasonable
   388  amount of time:</p>
   389  <pre class="literal-block">
   390  gm convert 4k.dpx -filter box -resize 1828x1556 -depth 10 2k.dpx
   391  </pre>
   392  <p>The above example command takes about 4 seconds (on an Apple 2.5GHz G5
   393  PowerMac or Intel 2.4GHz Xeon) to down-convert from a 131MB <em>5K</em>
   394  (5232x4376) original 16-bit scan from a NorthLight scanner to a 11MB
   395  <em>2K</em> 10-bit working image. Operations on more typical <em>2K</em> images take
   396  about a quarter of a second.</p>
   397  </div>
   398  <div class="section" id="annotate-image">
   399  <h2><a class="toc-backref" href="#id10">Annotate Image</a></h2>
   400  <p>The following example shows how GraphicsMagick's resize capability may
   401  be combined with its powerful drawing capability to take a full size
   402  source image and produce a smaller (720x576) version which includes
   403  the image filename and timecode at the top of the image, and a logo
   404  <em>bug</em> image in the bottom right corner:</p>
   405  <pre class="literal-block">
   406  gm convert infile.dpx -resize '720x576!' \
   407    -draw 'fill &quot;white&quot;;text-undercolor &quot;Blue&quot;;font &quot;Helvetica&quot;;font-size 18;\
   408       text 10,20 &quot;%f (%[DPX:tv.time.code])&quot;;image atop 500,400 0,0 &quot;gm-125x80t.png&quot;' \
   409    outfile.dpx
   410  </pre>
   411  <p>As may be seen, the argument to -draw can become extremely long, so to
   412  make things easy, the drawing commands may be placed in a simple text
   413  file and passed by reference to the draw comand:</p>
   414  <p>First lets check what we edited into our drawing command file:</p>
   415  <pre class="literal-block">
   416  % cat drawcmd.txt
   417  fill &quot;white&quot;
   418  text-undercolor &quot;Blue&quot;
   419  font &quot;Helvetica&quot;
   420  font-size 18
   421  text 10,20 &quot;%f (%[DPX:tv.time.code])&quot;
   422  image atop 500,400 &quot;0,0 &quot;gm-125x80t.png&quot;
   423  </pre>
   424  <p>and now we can apply it by passing the filename prefixed with a '&#64;' to the
   425  -draw command:</p>
   426  <pre class="literal-block">
   427  gm convert infile.dpx -resize '720x576!' -draw '&#64;drawcmd.txt' outfile.dpx
   428  </pre>
   429  <p>The <tt class="docutils literal">0,0</tt> in the image composition command argument says to use the
   430  image as is. If the composited image should be automatically resized,
   431  then simply replace the <tt class="docutils literal">0,0</tt> with the desired size.</p>
   432  <p>There are a number of powerful scripting environments for
   433  GraphicsMagick. One of these is RMagick (Ruby language interface to
   434  GraphicsMagick). In Ruby, the same effect may be obtained via a script
   435  that looks like:</p>
   436  <pre class="literal-block">
   437  #! /usr/local/bin/ruby -w
   438  require 'RMagick'
   439  include Magick
   440  img = Image.read('infile.dpx')[0]
   441  frog = Image.read('gm-125x80t.png')[0]
   442  gc = Draw.new
   443  gc.fill('white')
   444  gc.text_undercolor(&quot;Blue&quot;)
   445  gc.font(&quot;Helvetica&quot;)
   446  gc.font_size(18)
   447  gc.text(10, 20, &quot;%f (%[DPX:tv.time.code])&quot;)
   448  gc.composite(500, 400, 0, 0, frog, AtopCompositeOp)
   449  gc.draw(img)
   450  img.write('outfile.dpx')
   451  </pre>
   452  <p>In addition to Ruby, there are scripting interfaces for Perl, Python,
   453  Tcl, and Ch (C-like scripting language).</p>
   454  </div>
   455  <div class="section" id="colorspace-transformation">
   456  <h2><a class="toc-backref" href="#id11">Colorspace Transformation</a></h2>
   457  <p>To convert an RGB file to a 4:2:2 YCbCr file in Rec 709 space:</p>
   458  <pre class="literal-block">
   459  gm convert 2k.dpx -depth 10 -colorspace Rec709YCbCr -sampling-factor 4:2:2 2k-ycbcr.dpx
   460  </pre>
   461  </div>
   462  <div class="section" id="modifying-an-image-in-place">
   463  <h2><a class="toc-backref" href="#id12">Modifying An Image In-Place</a></h2>
   464  <p>Besides convert, which converts from one file to another, there is
   465  <a class="reference external" href="mogrify.html">mogrify</a> which transforms the file in place. A temporary file is used
   466  (if necessary) to ensure that the existing image file is not damaged
   467  if something goes wrong (e.g., not enough disk space). Note that
   468  unlike some applications supporting DPX/Cineon, when a file is modifed
   469  <em>in-place</em> , it is completely re-written.  While GraphicsMagick makes
   470  every attempt to preserve header information, some previously existing
   471  features of the file (such as the offset to the pixel data) may
   472  change.</p>
   473  <p>A typical mogrify command is</p>
   474  <pre class="literal-block">
   475  gm mogrify -resize 1828x1556 -depth 10 file-0001.dpx file-0002.dpx
   476  </pre>
   477  <p>Multiple files may be specified on the command line so the same
   478  command may process hundreds of files in one invocation.</p>
   479  <p>Unix users can use the find and xargs programs to perform operations
   480  on any number of files:</p>
   481  <pre class="literal-block">
   482  find /assets/001 -name '*.dpx' -print | \
   483    xargs gm mogrify -resize 1828x1556 -depth 10
   484  </pre>
   485  <p>Xargs works by pasting as many file names as possible on the end of
   486  the command provided to it.</p>
   487  <p>The GNU version of xargs provides an added benefit. It is able to run
   488  several commands in the background. This means that if your system has
   489  multiple CPUs, it can take advantage of all the CPUs while still using
   490  one command:</p>
   491  <pre class="literal-block">
   492  find /assets/001 -name '*.dpx' -print | \
   493    xargs --max-procs 3 --max-args 25 gm mogrify -resize 1828x1556 -depth 10
   494  </pre>
   495  <p>The mogrify command supports the -output-directory option to sent
   496  files to a different directory than the input files. This allows
   497  processing a large number of files without overwriting the input
   498  files:</p>
   499  <pre class="literal-block">
   500  mkdir dest
   501  cd source
   502  gm mogrify -output-directory ../dest -resize 1828x1556 -depth 10 '*.dpx'
   503  </pre>
   504  <p>Note that the entire input file path specification is preserved when
   505  composing the output path so that the input file path is simply
   506  appended to the output directory path. Also, unless the
   507  -create-directories option is added, the user is responsible for
   508  creating any necessary destination directories. As an example of the
   509  path composition algorithm, if the input file name is specified as
   510  source/file.dpx and the output directory is specified as dest, then
   511  the output file path will be dest/source/file.dpx.</p>
   512  <p>Here is an incantation which recursively processes all DPX files under
   513  source and sends the result to a similar directory tree under dest.</p>
   514  <pre class="literal-block">
   515  mkdir dest
   516  cd source
   517  find . name '*.dpx' -print | xargs gm mogrify -output-directory ../dest \
   518    -create-directories -resize 1828x1556 -depth 10
   519  </pre>
   520  </div>
   521  <div class="section" id="creating-a-contact-sheet">
   522  <h2><a class="toc-backref" href="#id13">Creating A Contact Sheet</a></h2>
   523  <p>GraphicsMagick may be used to create a contact sheet (grid of
   524  thumbnails with name and size) by using the <em>VID</em> pseudoformat which
   525  accepts a wildcarded argument of files (protected by quotes!) to
   526  read. The output files are buffered while files are being read so
   527  there is a practical limit to the number of files which may be
   528  processed at once. To output to a Postscript file:</p>
   529  <pre class="literal-block">
   530  gm convert &quot;vid:*.dpx&quot; &quot;contact-sheet.ps&quot;
   531  </pre>
   532  <p>or to a PDF file:</p>
   533  <pre class="literal-block">
   534  gm convert &quot;vid:*.dpx&quot; &quot;contact-sheet.pdf&quot;
   535  </pre>
   536  <p>or to a sequence of JPEG files ranging from contact-sheet-000.jpg to
   537  contact-sheet-999.jpg:</p>
   538  <pre class="literal-block">
   539  gm convert &quot;vid:*.dpx&quot; &quot;contact-sheet-%03d.jpg&quot;
   540  </pre>
   541  <p>or to a MIFF file which may be used to interactively browse the
   542  original files using 'gm display':</p>
   543  <pre class="literal-block">
   544  gm convert &quot;vid:*.dpx&quot; &quot;contact-sheet.miff&quot;
   545  </pre>
   546  </div>
   547  <div class="section" id="animating-a-sequence">
   548  <h2><a class="toc-backref" href="#id14">Animating A Sequence</a></h2>
   549  <p>GraphicsMagick may be used to animate an image sequence on an X11
   550  display using the <a class="reference external" href="animate.html">animate</a> subcommand. Frames are buffered in memory
   551  (pre-loaded into the X11 server) so the number of frames which may be
   552  animated at once is limited. GraphicsMagick has been used to animate
   553  1080P (1920x1080) images at 24 frames per second with at least 300
   554  frames in the sequence.More frames may be buffered on 64-bit
   555  systems. Many more frames may be animated by preparing a reduced set
   556  of frames in advance.</p>
   557  <p>To visualize an animation at 24 frames per second (delay (1/24)*100) use</p>
   558  <pre class="literal-block">
   559  gm animate -delay 4.17 'Frame_*.dpx'
   560  </pre>
   561  <p>In order to obtain a preview of a larger sequence, and if the frames
   562  are numbered, a broader span of time may be animated by selecting
   563  every 10^th frame (terminating with zero) to animate at 2.4 frames per
   564  second:</p>
   565  <pre class="literal-block">
   566  gm animate -delay 41.7 'Frame_*0.dpx'
   567  </pre>
   568  </div>
   569  <div class="section" id="displaying-one-image-frame">
   570  <h2><a class="toc-backref" href="#id15">Displaying One Image Frame</a></h2>
   571  <p>An image frame may be displayed on an X11 server using the <a class="reference external" href="display.html">display</a>
   572  subcommand. By default the name of the image file is displayed in the
   573  title bar. By specifying the format of the title, other useful
   574  information such as the time code (see the DPX Attributes section for
   575  more details) may be included in the window title:</p>
   576  <pre class="literal-block">
   577  gm display -title '%f (%[DPX:tv.time.code])' foo.dpx
   578  </pre>
   579  </div>
   580  <div class="section" id="viewing-a-sequence">
   581  <h2><a class="toc-backref" href="#id16">Viewing A Sequence</a></h2>
   582  <p>A sequence of images may be displayed on an X11 server using the
   583  <a class="reference external" href="display.html">display</a> subcommand. Unlike 'gm animate' there are no arbitrary limits
   584  when displaying a sequence this way. Unlike 'gm animate' the
   585  inter-frame delay can not be set to less than a second (100 ticks is
   586  one second).</p>
   587  <pre class="literal-block">
   588  gm display +progress -delay 100 'Frame_*.dpx'
   589  </pre>
   590  </div>
   591  <div class="section" id="using-the-batch-capability">
   592  <h2><a class="toc-backref" href="#id17">Using the Batch capability</a></h2>
   593  <p>A 'batch' command is provided (starting with the GraphicsMagick 1.3.18
   594  release) which supports executing an arbitrary number of
   595  GraphicsMagick commands from a file, or provided via standard input,
   596  while executing just one instance of GraphicsMagick.  This provides
   597  for more efficiency and for use of GraphicsMagick as a co-process.  An
   598  arbitrary script which produces the commands may continue to produce
   599  the commands as GraphicsMagick executes them.  For example (Bourne
   600  shell script):</p>
   601  <pre class="literal-block">
   602  outdir=outdir
   603  mkdir $outdir
   604  find fromdir -name '*.dpx'| sort |
   605  while read infile
   606  do
   607      outfile=$outdir/`basename $infile`
   608      echo time convert $infile -gaussian 0x1 $outfile
   609  done | gm batch -
   610  </pre>
   611  </div>
   612  </div>
   613  <div class="section" id="options-and-attributes">
   614  <h1><a class="toc-backref" href="#id18">Options And Attributes</a></h1>
   615  <div class="section" id="command-options">
   616  <h2><a class="toc-backref" href="#id19">Command options</a></h2>
   617  <p>The following command options are particularly useful when dealing with
   618  DPX files:</p>
   619  <dl class="docutils">
   620  <dt>-colorspace {CineonLog|RGB|Gray|Rec601Luma|Rec709Luma|Rec601YCbCr|Rec709YCbCr}</dt>
   621  <dd>Specifies the colorspace to be used when saving the DPX
   622  file. CineonLog selects log encoding according to Kodak Cineon
   623  specifications. RGB selects linear RGB encoding. Gray selects
   624  linear gray encoding similar to RGB, but with a single
   625  channel. Rec601Luma requests that RGB is converted to a gray image
   626  using Rec601 Luma. Rec709Luma requests that RGB is converted to a
   627  gray image using Rec709Luma. Rec601YCbCr requests that the image
   628  is saved as YCbCr according to Rec601 (SDTV)
   629  specifications. Rec709CbCr requests that the image is saved as
   630  YCbCr according to Rec709 (HDTV) specifications.</dd>
   631  <dt>-endian {lsb|msb}</dt>
   632  <dd>Specifies the endian order to use when writing the DPX
   633  file. GraphicsMagick writes big-endian DPX files by default since
   634  they are the most portable.  Other implementations may use the
   635  native order of the host CPU (e.g.  little-endian when using an
   636  Intel 'x86 CPU).</dd>
   637  <dt>-depth &lt;value&gt;</dt>
   638  <dd>Specifies the number of bits to preserve in a color sample. By
   639  default the output file is written with the same number of bits as
   640  the input file. For example, if the input file is 16 bits, it may
   641  be reduced to 10 bits via '-depth 10'.</dd>
   642  <dt>-define dpx:bits-per-sample=&lt;value&gt;</dt>
   643  <dd>If the dpx:bits-per-sample key is defined, GraphicsMagick will
   644  write DPX images with the specified bits per sample, overriding
   645  any existing depth value. If this option is not specified, then
   646  the value is based on the existing image depth value from the
   647  original image file. The DPX standard supports bits per sample
   648  values of 1, 8, 10, 12, and 16. Many DPX readers demand a sample
   649  size of 10 bits with type A padding (see below).</dd>
   650  <dt>-define dpx:colorspace={rgb|cineonlog}</dt>
   651  <dd>Use the dpx:colorspace option when reading a DPX file to specify
   652  the colorspace the DPX file uses. This overrides the colorspace
   653  type implied by the DPX header (if any). Currently files with the
   654  transfer characteristic Printing Density are assumed to be log
   655  encoded density while files marked as Linear are assumed to be
   656  linear. Hint: use <tt class="docutils literal"><span class="pre">-define</span> dpx:colorspace=rgb</tt> in order to avoid
   657  the log to linear transformation for DPX files which use Printing
   658  Density.</dd>
   659  <dt>-define dpx:packing-method={packed|a|b|lsbpad|msbpad}</dt>
   660  <dd>DPX samples may be output within 32-bit words. They may be tightly
   661  packed end-to-end within the words (&quot;packed&quot;), padded with null
   662  bits to the right of the sample (&quot;a&quot; or &quot;lsbpad&quot;), or padded with
   663  null bits to the left of the sample (&quot;b&quot; or &quot;msbpad&quot;). This option
   664  only has an effect for sample sizes of 10 or 12 bits. If samples
   665  are not packed, the DPX standard recommends type A padding. Many
   666  DPX readers demand a sample size of 10 bits with type A padding.</dd>
   667  <dt>-define dpx:pixel-endian={lsb|msb}</dt>
   668  <dd>DPX pixels should use the endian order that the DPX header
   669  specifies.  Sometimes there is a mis-match and the pixels use a
   670  different endian order than the file header specifies. For
   671  example, the file header may specify little endian, but the pixels
   672  are in big-endian order. To work around that use -define
   673  dpx-pixel-endian=msb when reading the file. Likewise, this option
   674  may be used to intentionally write the pixels using a different
   675  order than the header.</dd>
   676  <dt>-define dpx:swap-samples={true|false}</dt>
   677  <dd>GraphicsMagick strives to adhere to the DPX standard but certain
   678  aspects of the standard can be quite confusing. As a result, some
   679  10-bit DPX files have Red and Blue interchanged, or Cb and Cr
   680  interchanged due to an different interpretation of the standard,
   681  or getting the wires crossed. The swap-samples option may be
   682  supplied when reading or writing in order to read or write using
   683  the necessary sample order.</dd>
   684  <dt>-interlace plane</dt>
   685  <dd>By default, samples are stored contiguously in a single element
   686  when possible. Specifying '-interlace plane' causes each sample
   687  type (e.g.  'red') to be stored in its own image element. Planar
   688  storage is fully supported for grayscale (with alpha) and RGB. For
   689  YCbCr, chroma must be 4:2:2 subsampled in order to use planar
   690  storage. While planar storage offers a number of benefits, it
   691  seems that very few DPX-supporting applications support it.</dd>
   692  <dt>-sampling-factor 4:2:2</dt>
   693  <dd>Select 4:2:2subsampling when saving an image in YCbCr
   694  format. Subsampling is handled via a general-purpose image resize
   695  algorithm (lanczos) rather than a dedicated filter so subsampling
   696  is slow (but good).</dd>
   697  <dt>-set reference-white &lt;value&gt;</dt>
   698  <dd>Set the 90% white card level (default 685) for Cineon Log.</dd>
   699  <dt>-set reference-black &lt;value&gt;</dt>
   700  <dd>Set the 1% black card level (default 95) for Cineon Log.</dd>
   701  <dt>-set display-gamma &lt;value&gt;</dt>
   702  <dd>Set the display gamma (default 1.7) for Cineon Log.</dd>
   703  <dt>-set film-gamma &lt;value&gt;</dt>
   704  <dd>Set the film gamma (default 0.6) for Cineon Log.</dd>
   705  <dt>-set soft-clip-offset &lt;value&gt;</dt>
   706  <dd>Set the soft clip offset (default 0) when converting to <em>computer</em> RGB from
   707  Cineon Log.</dd>
   708  </dl>
   709  </div>
   710  <div class="section" id="dpx-attributes">
   711  <h2><a class="toc-backref" href="#id20">DPX Attributes</a></h2>
   712  <p>GraphicsMagick provides almost full access to DPX header
   713  attributes. DPX header attributes are shown in the output of 'gm
   714  identify -verbose' and may be set using the -define syntax
   715  (e.g. '-define dpx:mp.frame.position=2000') on the command line in
   716  order to add a value, or override an existing value. The attributes in
   717  the list below may be viewed or updated. The names are similar to the
   718  attribute descriptions from the DPX standard.</p>
   719  <pre class="literal-block">
   720  dpx:file.copyright
   721  dpx:file.creation.datetime
   722  dpx:file.creator
   723  dpx:file.encryption.key
   724  dpx:file.filename
   725  dpx:file.project.name
   726  dpx:file.version
   727  dpx:image.orientation
   728  dpx:mp.count
   729  dpx:mp.film.manufacturer.id
   730  dpx:mp.film.type
   731  dpx:mp.format
   732  dpx:mp.frame.id
   733  dpx:mp.frame.position
   734  dpx:mp.frame.rate
   735  dpx:mp.held.count
   736  dpx:mp.perfs.offset
   737  dpx:mp.prefix
   738  dpx:mp.sequence.length
   739  dpx:mp.shutter.angle
   740  dpx:mp.slate.info
   741  dpx:source.aspect.ratio.horizontal
   742  dpx:source.aspect.ratio.vertical
   743  dpx:source.border.validity.bottom
   744  dpx:source.border.validity.left
   745  dpx:source.border.validity.right
   746  dpx:source.border.validity.top
   747  dpx:source.creation.datetime
   748  dpx:source.device.name
   749  dpx:source.device.serialnumber
   750  dpx:source.filename
   751  dpx:source.scanned.size.x
   752  dpx:source.scanned.size.y
   753  dpx:source.x-center
   754  dpx:source.x-offset
   755  dpx:source.x-original-size
   756  dpx:source.y-center
   757  dpx:source.y-offset
   758  dpx:source.y-original-size
   759  dpx:tv.black.gain
   760  dpx:tv.black.level
   761  dpx:tv.breakpoint
   762  dpx:tv.field.number
   763  dpx:tv.gama
   764  dpx:tv.horizontal.sampling.rate
   765  dpx:tv.integration.time
   766  dpx:tv.interlace
   767  dpx:tv.sync.time
   768  dpx:tv.temporal.sampling.rate
   769  dpx:tv.time.code
   770  dpx:tv.user.bits
   771  dpx:tv.video.signal
   772  dpx:tv.white.level
   773  dpx:user.data.id
   774  </pre>
   775  <p>Specific header values from a DPX file may be displayed quickly using a command
   776  similar to:</p>
   777  <pre class="literal-block">
   778  gm identify -format '%[DPX:tv.time.code]' foo.dpx
   779  </pre>
   780  <p>Use</p>
   781  <pre class="literal-block">
   782  gm identify -format '%[dpx:*]' foo.dpx
   783  </pre>
   784  <p>to list all DPX header attributes.</p>
   785  <hr class="docutils" />
   786  <p>Copyright © GraphicsMagick Group 2002 - 2020</p>
   787  </div>
   788  </div>
   789  </div>
   790  </body>
   791  </html>