15
$\begingroup$

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.

$\endgroup$
3
  • $\begingroup$ Maybe RunScheduledTask or Refresh would be helpful. $\endgroup$
    – Silvia
    Jan 7, 2013 at 20:34
  • $\begingroup$ 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? $\endgroup$ Jan 14, 2013 at 12:24
  • $\begingroup$ 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]] $\endgroup$
    – Murta
    Jan 14, 2013 at 18:06

2 Answers 2

10
$\begingroup$

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.

$\endgroup$
5
  • $\begingroup$ 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 $\endgroup$
    – ssch
    Jan 7, 2013 at 20:50
  • 2
    $\begingroup$ Use WindowSize -> Full $\endgroup$
    – rm -rf
    Jan 7, 2013 at 21:30
  • $\begingroup$ 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... $\endgroup$ Jan 7, 2013 at 23:34
  • $\begingroup$ 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+ $\endgroup$
    – Murta
    Jan 8, 2013 at 2:08
  • $\begingroup$ V9 CDF Player was released last week. Download page now includes a CDF version checker at wolfram.com/cdf-player $\endgroup$ Jan 8, 2013 at 19:01
8
$\begingroup$

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.

$\endgroup$
2
  • 1
    $\begingroup$ Tks, nice suggestion of transition effect. $\endgroup$
    – Murta
    Jan 8, 2013 at 2:08
  • $\begingroup$ I changed i = 1 + Mod[i + 1, Length[img]] to i = Mod[i + 1, Length[img],1] so the last transition gets ok!.. $\endgroup$
    – Murta
    Jan 28, 2013 at 23:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.