Message Boards Message Boards

Embed an image into a CDF (Enterprise)?

Posted 8 years ago

I am developing an app and I would like to insert an image (logo) into it. I can't use import function because it does not embed the image in the CDF. I would like it to be part of the CDF without separately giving the image. Is that possible?

Here an example code...

Manipulate[
 DynamicModule[{f = Sin[x], xR = 1, xL = 0}, 
  Column[{ImageResize[
     Import["/Users/mac/Desktop/Logosmall.jpg"], {100}], 
    InputField[Dynamic[xL]], InputField[Dynamic[xR]], 
    InputField[Dynamic[f]], 
    Dynamic[NumberForm[
      NIntegrate[f, {x, xL, xR}, WorkingPrecision -> nw], 
      np]]}]], {{np, 10, "NumberFormat"}, 10, 30, 
  1}, {{nw, 16, "WorkingPrecision"}, 10, 30, 1}]

In here LogoSmall is the image I import. Of course it is not in the path or even in the computer that CDF will be used.

Is there any way of doing it?

POSTED BY: Erdem Uguz
4 Replies

Also, you can put the logo outside the Manipulate but inside the exported CDF. I normally create my CDFs exporting a notebook created with CreateDocument. One of the cells given to CreateDocument is the actual application (which could be a Manipulate), but the other cells have logos, titles, version history, etc.

POSTED BY: Gustavo Delfino
Posted 8 years ago

Thank you. I will learn the CreateDocument command. I am new to Mathematica.

POSTED BY: Erdem Uguz

You can inject data with With or use SaveDefinitions after storing it in a symbol.

Here's the former approach:

With[{logo =  ImageResize[Import["/Users/mac/Desktop/Logosmall.jpg"], {100}]
  },
 Manipulate[
  DynamicModule[{f = Sin[x], xR = 1, xL = 0}, 
   Column[{logo, (*rest of the column*)}]
  ],
   {{np, 10, "NumberFormat"}, 10, 30, 1}, {{nw, 16, "WorkingPrecision"}, 10, 30, 1}]
 ]
POSTED BY: Kuba Podkalicki
Posted 8 years ago

Thank you it worked perfectly.

POSTED BY: Erdem Uguz
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract