1
$\begingroup$

Is it possible to set an Image as the Background of a Panel? I've studied all the options in the Documentation center, but didn't find anything about it.

  image=Import["http://i.stack.imgur.com/U6Pby.jpg"]

Background Image

  Panel[Style["This is Infratab", 
                Bold, 
                20,
                Editable -> False
               ], 
      Background -> image, Alignment -> Center, ImageSize -> {400, 400}
  ](*panel is closed*)

Instead of a color, I want to set image as background of the Panel.

| improve this question | | | | |
$\endgroup$
2
$\begingroup$

You could try theOverlay command:

image = ImageResize[ExampleData[{"TestImage", "Tiffany"}], 300];
Overlay[
 {ImageAdjust[image, {0, 0.5}], 
  Panel[
   Plot[Sin[x], {x, 0, 10},
    PlotStyle -> {Thick, Red}, 
    ImageSize -> ImageDimensions[image]],
   Alignment -> Center,
   ImageSize -> ImageDimensions[image]
   ]}
 ]

enter image description here

| improve this answer | | | | |
$\endgroup$
  • $\begingroup$ ,sorry your code is also not working.I evaluated your code in my system. $\endgroup$ – subbu Nov 28 '12 at 15:40
  • $\begingroup$ try restarting Mathematica? $\endgroup$ – cormullion Nov 28 '12 at 15:53
  • $\begingroup$ Already I tried ,still not working. $\endgroup$ – subbu Nov 28 '12 at 18:20
  • $\begingroup$ works for me, MacOS X Mountain Lion, Mathematica 8.0.1. Sorry, can't help. $\endgroup$ – cormullion Nov 28 '12 at 19:58
  • $\begingroup$ @subbu What is your mma version? Is it a previous one than 8? Overlay is introduced in version 8. $\endgroup$ – Silvia Dec 1 '12 at 10:52
1
$\begingroup$

Something like this:

image = ExampleData[{"TestImage", "Man"}];
Panel[ImageCompose[image,
  Rasterize[Style["This is Infratab", Bold, 20, Yellow], 
   Background -> None]],
 Alignment -> Center, ImageSize -> {400, 400}]

enter image description here

| improve this answer | | | | |
$\endgroup$
  • $\begingroup$ ,you are specifying image as data with in panel,but I want to set image as Background to the Panel. $\endgroup$ – subbu Nov 28 '12 at 11:44
  • $\begingroup$ @ subbu - That isn't possible. Background is just for colours. $\endgroup$ – Chris Degnen Nov 28 '12 at 11:50
  • $\begingroup$ ,that was I Know,just I am trying is it possible or not? $\endgroup$ – subbu Nov 28 '12 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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