\(\(\( (*\ 
      Counterfeit\ Detection\ Based\ on\ Ink\ Color\ *) \)\(
\)\( (*\ Copyright\ May\ 2, \ 
      2006\ \ \ \ Doug\ Youvan\ \ \ \ www . youvan . com\ \ \ \ \ \ www . 
          pseudocolor . 
          com\ *) \)\(
\)\(
\)\(\(Clear\ [
        benslice];\)

    \(benslice\  = \ 
        Import["D:\Mathematica\Data\benslice2.jpg"];\)
 (*\ 
      The\ top\ half\ of\ benslice2\ has\ been\ adjusted\ in\ PS\ as\  + 
        14\ green\ with\ constant\ luminosity\ *) 

    \(Export\ ["D:\Mathematica\Data\benslice.tif", \ 
        benslice];\)

    \(benslice\  = \ Import["D:\Mathematica\Data\benslice.tif"];\)

    \(benslice\  = \ benslice\  /. \ Graphics\  -> \ List;\)

    \(pixelvalues\  = \ benslice[\([1, 1]\)];\)

    \(pv = pixelvalues/255;\)

    \(size = Dimensions[pv];\)

    \(width = size[\([2]\)];\)

    \(height = size[\([1]\)];\)

    \(Show[Graphics[RasterArray[Apply[RGBColor, \ pv, \ {2}]]]\ , 
        ImageSize\  -> \ {width, height}, \ 
        AspectRatio -> Automatic];\)


    \)\)\)

\(\(\(
\)\(
\)\( (*\ 
      Single\ image\ output\ *) \)\(
\)\(
\)\(\(newrgbpixels = {pv[\([Random[Integer, {1, height}], \ Random[Integer, {1, width}]]\)], 
          pv[\([Random[Integer, {1, height}], \ 
              Random[Integer, {1, width}]]\)], 
          pv[\([Random[Integer, {1, height}], \ 
              Random[Integer, {1, width}]]\)]};\)

    \(inv = Inverse[newrgbpixels];\)

    \(ortho\  = \ pv\  . inv;\)

    \(gortho = 
        Graphics[RasterArray[Apply[RGBColor, \ ortho\ , {2}]], 
          AspectRatio -> \ Error, \ 
          ImageSize -> {width, \ 
              height}];\)\ \ 

 (*\ 
      AspectRatio\ is\ flakey; \ 
      must\ trip\ error\ to\ get\ correct\ export\ \ *) 


    \(Show[gortho];\)

    \(Export["D:\Mathematica\Data\gortho.gif", \ gortho, \ "GIF", 
        ImageSize -> {width, \ 
            height}];\)\ 

 (*\ 
      Exporting\ as\ 288\ x\ 34, \ regardless\ of\ gif, \ tif, \ 
      jpg\ format\ *) 

    \)\)\)

\(\(\(
\)\(
\)\( (*\ 
      looped\ for\ 26\ images\ to\ be\ output\ and\ then\ assembled\ in\ an\ animation\ program\ *) \)\(
\)\(
\)\(\(name = 
        Table[i, {i, 1, 51}];\)


    \(For[i = 1, 
        i < 26, \ 

newrgbpixels = {pv[\([Random[Integer, {1, height}], \ Random[Integer, {1, width}]]\)], 
            pv[\([Random[Integer, {1, height}], \ 
                Random[Integer, {1, width}]]\)], 
            pv[\([Random[Integer, {1, height}], \ 
                Random[Integer, {1, width}]]\)]}; 

        inv = Inverse[newrgbpixels]; 
ortho\  = \ pv\  . inv; 
        gortho = 
          Graphics[RasterArray[Apply[RGBColor, \ ortho\ , {2}]], 
            AspectRatio -> \ Error, \ 
            ImageSize -> {width, \ height}]; \ \ 
Show[
          Graphics[
            gortho]]; 
Export["D:\Mathematica\Data\" <> \ ToString[name[\([i]\)]]\  <> \ ".gif", \ gortho, "GIF", \ 
          ImageSize -> {width, \ 
              height}]; \ 

\(i++\)];\)

 (*\ 
      Exporting\ as\ 288\ x\ 34\ *) 

    \)\)\)