15

I'm experimentally trying to use CDF Player to create an Dashboard TV here in the company (like in the airport, see image below). I would like to configure the CDF file so It could be displayed in full screen as a slide show. The TV has a resolution of 1280x720.

enter image description here

The idea is to setup each slide to have some time duration, and use some fade transition. Each slide is a image with the 1280x720 resolution, generated by Mathematica and saved in one specific file folder. As I use enterprise version, I have no problem in make CDF Player to have external folder access, and ready there images.

Important points:

  1. If the files in the folder are updated, it should be automatic updated in the dashboard, without need to restart it. The image file names and number in the folder are always the same.
  2. Nice transition effect (like new version 9 options)
  3. Make the mouse disappear
  4. Should works on CDF (enterprise version, that can import local files)

I'll be very glad with some ideas on how could I implement it.

Murta
  • 26,275
  • 6
  • 76
  • 166
  • Maybe RunScheduledTask or Refresh would be helpful. – Silvia Jan 07 '13 at 20:34
  • How many files do you have in the folder? Would it be fast enough to just load each of them before displaying and thus fulfilling point 1. trivially? Could you make a list of files downloadable somewhere for easier experimentation? – Rolf Mertig Jan 14 '13 at 12:24
  • Hi Rolf. If I import all of then just one time, I can't update then on the run. The images are not important for the test, due to that I haven't posted any example. But there is some test: images = ImageCrop[ImageResize[#, 500], {1280, 720}] & /@ ExampleData /@ ExampleData["TestImage"][[1 ;; 6]] – Murta Jan 14 '13 at 18:06

2 Answers2

10

Perhaps this will get you started...

nb = CreateDocument[
   DynamicModule[{n}, n = 0; 
    Dynamic[Refresh[
      Image[Import[dir <> imgfiles[[Mod[n++, Length[imgfiles], 1]]]], 
       ImageSize -> {1280, 720}], UpdateInterval -> 5, 
      TrackedSymbols :> {}]],
    Initialization :> (SetDirectory[dir]; imgfiles = FileNames[])], 
   WindowSize -> Full, WindowFrame -> "Frameless", 
   WindowElements -> {}, ScreenStyleEnvironment -> "Presentation"];
CurrentValue[Cells[nb][[1]], CellMargins] = {{0, 0}, {0, 0}}; 
CurrentValue[Cells[nb][[1]], ShowCellBracket] = False; 
CurrentValue[Cells[nb][[1]], CellFrameMargins] = 0;

I put the initialization code into the DyanmicModule with the Initialization :> ... option. Replace dir with an appropriate directory name.

rm -rf
  • 88,781
  • 21
  • 293
  • 472
Michael E2
  • 235,386
  • 17
  • 334
  • 747
  • I too can't go fullscreen, even with normal notebooks (Window->Full Screen) thought I had some odd window manager settings, v8.0.4 on kde – ssch Jan 07 '13 at 20:50
  • 2
    Use WindowSize -> Full – rm -rf Jan 07 '13 at 21:30
  • Interesting -- Cells isn't documented in version 8.0.4 but still seems to work. As I think the version 9 players are not yet available that might be of interest... – Albert Retey Jan 07 '13 at 23:34
  • Uou!.. Very cool. And full screen worked ok in my mac on version 9. Now I'm trying to integrate @RolfMertig suggestion of TransitionEffect on it. Tks a lot! It's just what I needed. 1+ – Murta Jan 08 '13 at 02:08
  • V9 CDF Player was released last week. Download page now includes a CDF version checker at http://www.wolfram.com/cdf-player – Andre Kuzniarek Jan 08 '13 at 19:01
8

Animate seems to be useless here, so even while one could use TransitionEffect -> "Fade" ... :

 Animate[PaneSelector[Thread[Range[Length[pics]] -> pics], Dynamic@i, 
      TransitionEffect -> "Fade"], {i, 1,(*Length[pics]*)5, 1}, 
     DefaultDuration -> 3,
     Initialization :> (pics =(*Import["G:\\pics\\*.jpg"]*)
        Table[Plot3D[Sin[x^i] Cos[y^i], {x, -3, 3}, {y, -5, 5}], {i, 5}])]

I could not embed this in such a way into a CDF that the controls do not show up.

So, with way too much effort (am I the only one who thinks that Refresh, Dynamic and ScheduledTasks and all that are hard to get right?) I got this, which seems to work fine:

DynamicModule[{img, i, images, stillpause, fade, fadepause},

 img = ImageCrop[ImageResize[#, 500], {1280, 720}] & /@ 
   ExampleData /@ ExampleData["TestImage"][[1 ;; 6]];
 images = Append[img, First[img]];
 stillpause = 1;
 fade = 0.;
 fadepause = 0.1;
 fadestep = 0.1;
 i = 1;
 Dynamic[Pause[fadepause];
  fade = Mod[fade + fadestep, 1];
  If[Round[fade 10] == 1, Pause[stillpause]; 
   i = 1 + Mod[i + 1, Length[img]]];
  ImageCompose[images[[i]], {images[[i + 1]], fade}]
  (*{i,i+1,fade}*)
  ]

 ]

With respect to reading images from a file and checking for new ones the algorithm is easy: read in the FileDates in Initialization and compare inside the Dynamic and read it in if it changed. But to code this takes even more time, so I stop here.

Rolf Mertig
  • 17,172
  • 1
  • 45
  • 76