Computable Document (Format^™) CDF for Sharing Applications

Desmond Lim
OEMS IntiPakar Corporation Sdn Bhd

Table of Contents

Introduction

What is Computable Document Format (CDF)?

How to create a (FreeCDF^™)

How to deploy FreeCDFs

What is EnterpriseCDF?

EnterpriseCDF examples

Enterprise licensing information

Introduction

What is CDF?

Computable Document Format developed by Wolfram and released in 2011

Easy-to-author interactivity

Provides a broad communication pipeline to accelerate research and technical development

Share your research results in a more engaging and powerful format

Deliver your course materials into an engaging format, suitable for classroom and online classes

Examples

Consulting Reports

Investment Statements

Textbooks

Why CDF ?

Traditional documents are like yesterday’s paper–flat, lifeless, and inactive

May be easy to author, but not very engaging

Traditional applications fall short

Many Flash-based applications are little more than animation of static content

Button[,SystemOpen[File["D:\\Mathematica references\\CDF Projects\\test.flv"]]]

More interesting and interactive applications are possible, but require proficiency in languages like Java

The aim of CDF is to give a richer way to communicate ideas and information, but with an easy workflow.

Manipulate[
Module[{anglegraph,maingraph},
anglegraph[th_,showtext_]:=Show[
Graphics[{
{Lighter[Gray,0.5],Circle[{0,0},1]},
{Darker[Green,0.2],Thick,Circle[{0,0},1,{0,th}]},
{Lighter[Gray,0.5],Line[{{0,0},{Cos[th],Sin[th]}}]},
{Red,Thick,Line[{{Cos[th],0},{Cos[th],Sin[th]}}]},
If[showtext,Rotate[Text[Style[N[Sin[th]],11],{Cos[th]-0.15,Sin[th]/2}],3Pi/2,{Cos[th]-0.15,Sin[th]/2}],{}],
{Lighter[Red,0.3],Dashing[Medium],Line[{{Cos[th],Sin[th]},{2,Sin[th]}}]}
}],
PlotRange->1,ImageSize->145,BaseStyle->{12},Axes->True,Ticks->{{-1,1},{-1,1}},PlotRange->{{-1,1},{-1,1}},PlotRangePadding->0.25];

maingraph[th_,showtext_]:=Module[{},
Show[Plot[{Sin[x]},{x,0.0001,th},PlotRange->{{0,2Pi},{-1,1}},PlotRangePadding->{0,0.25},ImagePadding->{{30,12},{0,0}},PlotRangeClipping->False,PlotStyle->Gray,
Ticks->{Table[{n Pi/4,n Pi/4},{n,0,8}],Table[n,{n,-1,1,1/2}]},
GridLines->{Table[{n Pi/4,Lighter[Gray,0.7]},{n,-2,8}],Table[{n,Lighter[Gray,0.7]},{n,-1,1,1/2}]},ImageSize->{Automatic,145}],
Graphics[{If[showtext,Rotate[Text[Style[N[Sin[th]],11],{th+0.15,Sin[th]/2}],3Pi/2,{th+0.15,Sin[th]/2}],{}],
{Lighter[Red,0.3],Dashing[Medium],Line[{{th,Sin[th]},{-2,Sin[th]}}]},
{Darker[Green,0.2],Thick,Line[{{0,0},{th,0}}]},
{Red,Thick,Line[{{th,0},{th,Sin[th]}}]}
}],AspectRatio->Automatic,BaseStyle->{12}]];

DynamicModule[{pt={Cos[ptctrl],Sin[ptctrl]},pt2={ptctrl,0}},
Labeled[Grid[{
{LocatorPane[Dynamic[pt,
{(pt={Cos[pt2[[1]]],Sin[pt2[[1]]]})&,
(pt=Normalize[#];pt2={If[pt2=={2Pi,0},2Pi,Mod[ArcTan[#[[1]],#[[2]]],2 Pi]],0})&,
(pt=Normalize[#];ptctrl=pt2[[1]])&}],
Dynamic[anglegraph[If[pt2=={2Pi,0},2Pi,Mod[ArcTan[pt[[1]],pt[[2]]],2 Pi]],showvalue]]],
LocatorPane[Dynamic[pt2,
{(pt2={If[pt2=={2Pi,0},2Pi,Mod[ArcTan[pt[[1]],pt[[2]]],2 Pi]],0})&,
(pt2={#[[1]],0};pt={Cos[#[[1]]],Sin[#[[1]]]})&,
(pt2={#[[1]],0};ptctrl=#[[1]])&}],
Dynamic[maingraph[If[pt2=={2Pi,0},2Pi,Mod[ArcTan[pt[[1]],pt[[2]]],2 Pi]],showvalue]]]}},Spacings->0],{Row[{Style["Illustrating ","Label",20,Gray],Text@Style["sin(",Red,24],Text@Style["x",Italic,Bold,Darker[Green,0.3],24],Style[")",Red,24]}],
Style["",10,Lighter[Gray,0.7],"Label"]},{{Top,Left},{Bottom,Right}}]]
],
{{showvalue,False,"show value"},{False,True}},
{{ptctrl,Pi/6,"angle"},0,2Pi},TrackedSymbols:>{showvalue,ptctrl}]

How CDF compares (table)

Benefits of CDF

Makes authoring and sharing interactive content simple

Easy for a non-programmer to develop

Create once, and then deploy as slide shows, reports, books, applications, and web objects

One CDF can contain text, graphics, typesetting, interactive components, embedded programs, and more

People can view your content without needing to have Mathematica

Empowers your audience

Recipients can drive content and generate live results instead of passively consuming static, pregenerated content

How to Create FreeCDFs

Create content using Mathematica

Use any of Mathematica’s thousands of built-in commands to generate content, and use the word processing and text formatting capabilities to structure your document.

Plot[Sin[10x]+Sin[2x],{x,0,2π}]

Make it interactive using Manipulate

Mathematica’s Manipulate command can be used to instantly create interactive models.

Manipulate[
Plot[Sin[10x]+Sin[f*x+θ],{x,0,2π},Filling->filling,FillingStyle->color],
{f,10,20},
{θ,0,2π},
{color,Cyan},
{filling,{None,Axis,Top,Bottom}}
]

All About Manipulate

Manipulate[
DynamicModule[{ppts,spts},
Grid[{{
Dynamic[
ppts=If[sorted,SortBy[pts,Last],pts];
spts=Table[Append[#,Last[p]]&/@(First[p] cpts),{p,ppts}];
Graphics3D[{
If[mesh,
(* Draw control meshes *)
{FaceForm[],EdgeForm[Gray],Polygon[spts],Gray,Line[Transpose[spts]],Red,PointSize[Medium],Point/@spts},{}],
FaceForm[frontc,backc],Opacity[op],Specularity[White,50],
(* NURBS Surface *)
BSplineSurface[spts,SplineClosed->{False,True},SplineDegree->2,SplineKnots->{Automatic,k},SplineWeights->Table[w,{Length[pts]}]]},
PlotRange->{{-1,1},{-1,1},{0,1}},BoxRatios->{1,1,1.25},ImageSize->300{1,1}]],
(* Profile curve *)
Labeled[LocatorPane[Dynamic[pts],
Dynamic[Graphics[{BSplineCurve[ppts,SplineDegree->2],Dashed,Orange,Line[ppts]},PlotRange->{{0,1},{0,1}},Frame->True,FrameTicks->None,GridLines->Automatic,GridLinesStyle->LightGray,AspectRatio->2.5,ImageSize->80{1,2.5}]],LocatorAutoCreate->{2,∞}],Style["profile curve","Label"],Top]
}}]
],
"None"->{{pts,{{0.5,0},{0.2,0.25},{0.5,0.5},{0.8,0.75},{.5,1}}},{0,0},{1,1},ControlType->None},
Row[{
Column[{Control[{{sorted,True,"sort control points"},{True,False}}],
Control[{{mesh,False,"show control mesh"},{True,False}}]},Right],
Spacer[20],
Column[{Control[{{frontc,Yellow,"outside color"},Yellow,ImageSize->Tiny}],
Control[{{backc,Blue,"inside color"},Blue,ImageSize->Tiny}]},Right],
Spacer[20],
Column[{Control[{{op,1,"opacity"},0,1,ImageSize->Tiny}]}]
}],
AutorunSequencing->{1,3,4,5},
Initialization:>(cpts={{0,-1},{-1,-1},{-1,1},{0,1},{1,1},{1,-1}};
w={1,.5,.5,1,.5,.5};
k={0,0,0,1/4,1/2,1/2,3/4,1};),
SaveDefinitions->True
]

Types of Controls

DynamicModule[{x=0.5,y=1,b=True,r=Random[],filename="(no file)",n,s,c=LightGray,p={0,0}},Manipulate@Grid[({{Tooltip[Slider[Dynamic[s]],"Slider[Dynamic[x], {min, max}]"], Tooltip[InputField[Dynamic[r],Expression,FieldSize->{{10,10},{1,1}}],"InputField[Dynamic[x], type]"], Tooltip[CheckboxBar[{"apples","bananas"},{"apples","oranges","bananas"}],"CheckboxBar[Dynamic[x], list]"]}, {Tooltip[ProgressIndicator[Dynamic[x],{0,1}],"ProgressIndicator[Dynamic[x], {min, max}]"], Tooltip[PopupMenu["Alice",{"Alice","Bob","Cos" -> Plot[Cos[t],{t,0,10}],Integrate[1/(1 - ξ^3), ξ]},ImageSize->Automatic,Enabled->Dynamic[b]],"PopupMenu[Dynamic[x], list]"], Tooltip[RadioButtonBar["no",{"yes","no","maybe"}],"RadioButtonBar[Dynamic[x], list]"]}, {Tooltip[TogglerBar[{α},{α,β,γ,δ,ϵ}],"TogglerBar[Dynamic[x], list]"], Tooltip[ColorSlider[Dynamic[c]],"ColorSlider[Dynamic[x]]"], Row[{Tooltip[FileNameSetter[Dynamic[filename]],"FileNameSetter[Dynamic[x]]"],Dynamic[filename]},"  "]}, {Row[{Tooltip[Opener[],"Opener[Dynamic[x]]"],Tooltip[Checkbox[Dynamic[b]],"Checkbox[Dynamic[x]]"],Tooltip[RadioButton[Dynamic[y],3],"RadioButton[Dynamic[x], value]"],Tooltip[Button["click",r=Random[],ImageSize->Automatic],"Button[label, action]"]}], Tooltip[Animator[Dynamic[x],AnimationRunning->False,AppearanceElements -> {"StepLeftButton","StepRightButton","PlayPauseButton","FasterSlowerButtons","DirectionButton"}],"Animator[Dynamic[x], {min, max}]"], Tooltip[Hyperlink["www.wolfram.com","http://wolfram.com/"],"Hyperlink[label, url]"]}, {Tooltip[TabView[Plot[Sin[# x],{x,0,10},ImageSize -> Small,Background->Dynamic[c]]& /@ Range[5],Dynamic[n]],"TabView[list, Dynamic[x]]"], Row[{Tooltip[Slider2D[Dynamic[p],{-{1,1},{1,1}}],"Slider2D[Dynamic[x],{min,max}]"],Tooltip[VerticalSlider[Dynamic[s],ImageSize->Small],"VerticalSlider[Dynamic[x], {min, max}]"]},Spacer[10]], Labeled[
Tooltip[SetterBar[Dynamic[n],{1,2,3,4,5}],"SetterBar[Dynamic[x], list]"],
Tooltip[PaneSelector[{1->,2->,3->,4->,5->},Dynamic[n]],"PaneSelector[list, Dynamic[x]]"]]}, {Tooltip[Manipulator[Dynamic[s],Appearance->"Open"],"Manipulator[Dynamic[x], {min, max}]"], Tooltip[Deploy@Graphics[{Line[Table[{Dynamic[p],{Cos[a],Sin[a]}},{a,0,2π,π/16}]],Locator[Dynamic[p]]},PlotRange->1.2,ImageSize->80],"Graphics[{…, Locator[Dynamic[x]], …}]"], Tooltip[ActionMenu["To Do",{"Pink":>(c=Pink),
"Three":>(n=3),
"Top":>(p={0,1}),
"Bottom":>(p={0,-1})
}],"ActionMenu[name, {label :> action, …}]"]}}),Spacings->{2,1}]]

Build custom applications with user-interface elements

The building blocks that Manipulate uses—sliders, checkboxes, input fields, buttons, and more—can be used directly to create custom interfaces.

DynamicModule[{red=0,green=0,blue=0},
Column[{Grid[{
{Graphics[{Red,Rectangle[]},ImageSize->30],Slider[Dynamic[red],Appearance->"Labeled"]},{Graphics[{Green,Rectangle[]},ImageSize->30],Slider[Dynamic[green],Appearance->"Labeled"]},
{Graphics[{Blue,Rectangle[]},ImageSize->30],Slider[Dynamic[blue],Appearance->"Labeled"]}}],
Dynamic[Graphics[{RGBColor[Dynamic[red],Dynamic[green],Dynamic[blue]],Disk[]}]]}]]

Column[{Row[{"Player ",Toggler[Dynamic[player],{"X","O"},Enabled->False]}],Grid[Table[Module[{x=" "},Dynamic[Toggler[Dynamic[x,(x=#;player=player/.{"X"->"O","O"->"X"};)&],{" ",player},Enabled->(Dynamic[x==" "]),ImageSize->{15,15},Alignment->{Center,Center}]]],{3},{3}],Frame->All]}]//Style[#,FontFamily->"Arial"]&

How to Deploy FreeCDFs

Deploy CDFs as desktop applications or documents, or as full pages or embedded objects within a web browser.

Desktop applications

1. Deploy the entire file (or just a selected portion) using File ▶ CDF Export ▶ Standalone ▶ FreeCDF and following the wizard’s instructions.
2. Send the resulting CDF to a colleague, coworker, student, friend...
3. The CDF can be viewed using Mathematica or the free Wolfram CDF Player.

Web applications

1. Deploy the entire file (or just a selected portion) using File ▶ CDF Export ▶ Web Embeddable ▶ FreeCDF and following the wizard’s instructions.
2. Upload the file to the appropriate web server location.
3. Paste the code from the wizard into the appropriate web page.
4. Load the web page to view the embedded CDF.

NOTE: To view CDF content embedded in a web page, you need to have the CDF Player browser plugin installed. This plugin is automatically installed with standard Mathematica and Wolfram CDF Player installations and is supported by many browsers.

Non-embedded full-screen CDF on the web

Besides being embedded, CDFs can be viewed in a browser in full-screen mode when selected via hyperlinks.

NOTE: As above, the CDF Player browser plugin needs to be installed, and various MIME types need to be set. More details are available at the Wolfram website.

What Is EnterpriseCDF?

EnterpriseCDF can be used as a computation-powered knowledge container, like FreeCDF, but provides more functionality and control when deploying applications

Benefits of EnterpriseCDF

Work with proprietary data

EnterpriseCDF allows data import, including Excel spreadsheets, images, database files, and web-based data.

More flexible, user-driven input

EnterpriseCDF works with input fields that accept arbitrary user input, allowing users to enter textual responses, comments, custom images, full symbolic expressions, and more.

Export your results

EnterpriseCDF can export data in a variety of file formats, like JPG, PDF, TXT, XLSX, and CDF, and this creation can be automated, providing a way to easily update reports on web pages or to send to recipients’ inboxes.

Protect your Intellectual Property

EnterpriseCDF supports code encryption and is licensed in a manner so that the author has control over redistribution.

How EnterpriseCDF Compares to FreeCDF

Features comparison chart (link)

Examples of EnterpriseCDF Projects

More flexible, user-driven programs

FreeCDF applications are restricted to mouse-driven input, which can be quite powerful, but does have certain limitations.

Manipulate[
Column[{
Row[{Style["Move the sliders to vary the coefficients in the equation, ", 14, RGBColor[0.027451, 0.00784314, 0.4], FontFamily->"Arial"],
Style["y =(a/b) x + c", 18, RGBColor[0.027451, 0.00784314, 0.4],FontFamily->"Arial"]}],
" ",
Style[Row[{"y = ",((ToString[a])/(ToString[b]))," x + ",c,}], 18,FontFamily->"Arial"],
Plot[(a/b) x+c,{x, -10, 10}, PlotRange-> {-10,10}, ImageSize-> 350]
}, Alignment->Center],
{a, 1,10,1},
{b, 1,10,1},
{c, 1,10,1}
]

EnterpriseCDFs do not have the same constraints and allow arbitrary input. For example, the same application can be written with an input field that accepts an arbitrary expression containing two variables that are hooked up to controllers, providing much more control to users.

Panel[
DynamicModule[{eq1=x+5, eq2=x+5, a111=1, b111=1},
Column[{
Column[{
Style["Enter any equation using the symbols \"a\" and \"b\" as dynamic variables ", 14, Bold,GrayLevel[0.35]],
Row[{Style["Enter equation: ", GrayLevel[0.35]],InputField[Dynamic[eq1]]}],
Button["Update graph", eq2=eq1, ImageSize->150],
─
}],
Column[{
Row[{"a (1 to 5): ",Slider[Dynamic[a111], {1,5, 0.05},Appearance->"Labeled"]}],
Row[{"b (1 to 5): ",Slider[Dynamic[b111], {1,5, 0.05},Appearance->"Labeled"]}],
Dynamic[eq2/.{a-> a111, b->b111}//TraditionalForm//Style[#,"Text"]&],
Dynamic[Plot[eq2/.{a-> a111, b->b111}, {x, -10, 10}, PlotRange->{-10, 10},
PlotStyle->Directive[Thick,RGBColor[0.2,0.6,0.8]],
Filling->Axis,FillingStyle->Directive[Opacity[0.3],RGBColor[0.2,0.6,0.8]],
BaseStyle->{FontFamily->"Arial"},
ImageSize->400]]
}, Alignment-> Center]
}]
]
]

Automated analysis

Use EnterpriseCDF to read in datasets and perform statistical analysis. View the results directly in Mathematica or CDF Player, export them to a file, or email them to a recipient.

data=Table[{RandomReal[1,10][[i]],RandomReal[{5,10},10][[i]]},{i,1,10}]

SetDirectory[];Export["sampledata.xlsx",data]

Framed[Panel[
DynamicModule[{filename=Style["none selected", 14], plots=Style["no dataset loaded", 14], deg=6},
Column[{
Style["Data Fitting Application", 16,Bold,FontFamily->"Arial",GrayLevel[0.35]],
Style["Fits a selected dataset with polynomial fits up to a max degree.",GrayLevel[0.375]],Style["Also provides (r^2) values for the fits.", GrayLevel[0.375]],
─,
FileNameSetter[Dynamic[filename], Appearance-> "Choose file for dataset"],
Style["Dataset for analysis:", RGBColor[0.2472,0.24,0.6]],
Panel@Dynamic[filename],
─,
Row[{Style["Maximum degree for fit:   ", RGBColor[0.8, 0.05, 0]],InputField[Dynamic[deg], FieldSize->2]}],
Row[{
Button["Visualize fits",
If[StringTake[filename,-4]=="xlsx", dataFitApp[Import[filename][[1]], deg],dataFitApp[Import[filename, "Data"], deg]], ImageSize-> Automatic]
},Spacer[5]],
Row[{
Style["Email password: "],
InputField[Dynamic[password],FieldMasked->True,FieldSize->7],
Button["Email results as PDF",
If[StringTake[filename,-4]=="xlsx", dataFitApp[Import[filename][[1]], deg],SendMail["From"->"qa1640@gmail.com","To"->"mmorrison@wolfram.com","Subject"->"Results from Data Fitting Application","Body"->{"Program run time: "<>DateString[]<>"\nFilename used for fits: "<>ToString[filename],plots},"UserName" -> "qa1640@gmail.com","Password"->ToString@First@Dynamic@password,"Server"->"smtp.gmail.com","EncryptionProtocol"->"SSL","PortNumber"->465]], ImageSize-> Automatic,Method->"Queued"]
},Spacer[5]],
Panel@Dynamic[plots]
},Alignment->Center],
Initialization:>(dataFitApp[data_, polydegree_]:=
(fits=Table[LinearModelFit[data,Table[(x^j),{j,0,i}],x],
{i,1,polydegree}];
plots=Row[Table[
Show[ListPlot[data,BaseStyle->{FontFamily->"Arial"},FrameStyle->GrayLevel[0.5],GridLines->Automatic,GridLinesStyle->Directive[GrayLevel[0.7]]],Plot[fits[[i]]["BestFit"],{x,0,100},PlotStyle->Red,FrameStyle->GrayLevel[0.5],GridLines->Automatic,GridLinesStyle->Directive[GrayLevel[0.7]]],
ImageSize->300,Frame-> True,
BaseStyle->{FontFamily->"Arial"},PlotLabel->Style["degree "<>ToString[i]<>" polynomial"<>"\n"<>"(r^2): "<>ToString[fits[[i]]["RSquared"]],FontFamily->"Arial",GrayLevel[0.4]]],
{i,polydegree}],Frame->True,ImageMargins->10];
SetDirectory[NotebookDirectory[]];
))],Background->RGBColor[0.90,0.95,1]],
FrameMargins->0,FrameStyle->GrayLevel[0.35]]

Which Should I Choose?

Do you need control over redistribution? If so, then EnterpriseCDF.

Do you need advanced functionality, like data import and export and code encryption? If so, then EnterpriseCDF.

Examples of use cases (link)

Conclusion

CDF technology provides a much richer way to deliver information than traditional formats. It’s ideal for classroom or distant education, technical reports, business presentation etc..

Recipients can interact with CDFs to generate content and drive results, as opposed to the one-sided model of static delivery and consumption

EnterpriseCDFs have enhanced functionality, but can still be run in the free CDF Player

Mathematica Enterprise Edition is the authoring platform to create EnterpriseCDFs

Initialization

Color

Clear[m8red];
m8red[a_]:=RGBColor[0.811765,0.117647,0.145098,a];

C Compiler

Needs["CCodeGenerator`"]

Special Cells

Picture Cell

PicturePrint[expr_,opts:OptionsPattern[Cell]]:=CellPrint[TextCell[expr,"Picture",opts,ShowStringCharacters->False]]

Overview Mouseover

OverviewMouseover[header_,subs_]:=CellPrint@Cell[BoxData[ToBoxes@Mouseover[Framed[Style[header,"OverviewSection"],FrameMargins->{{15,15},{5,5}},BoxFrame->2,FrameStyle->None,RoundingRadius->5],

Evaluate@If[subs=="",Framed[Style[header,"OverviewSection",White],FrameMargins->{{15,15},{5,5}},BoxFrame->2,FrameStyle->None,RoundingRadius->5,Background->m8red[1]],Row[{Framed[Style[header,"OverviewSection",White],FrameMargins->{{15,15},{5,5}},FrameStyle->None,RoundingRadius->5,Background->m8red[1]]," » ",Framed[Style[subs,"OverviewSection"],FrameMargins->{{15,15},{5,5}},FrameStyle->m8red[1],BoxFrame->2,RoundingRadius->5,Background->White]}]]]],"OverviewSection"]

(*MapThread[OverviewMouseover,Transpose[{{"Chapter One","Chapter One topics, …"},{"Chapter Two","Chapter Two topics, …"},{"Chapter Three","Chapter Three topics, …"},{"Chapter Four","Chapter Four topics, …"}}]]*)

Large Overview Mouseover

LargeOverviewMouseover[header_,subs_]:=CellPrint@Cell[BoxData[ToBoxes@Mouseover[Framed[Style[header,"LargeOverviewSection"],FrameMargins->{{15,15},{5,5}},BoxFrame->2,FrameStyle->None,RoundingRadius->5],

Evaluate@If[subs=="",Framed[Style[header,"LargeOverviewSection",White],FrameMargins->{{15,15},{5,5}},BoxFrame->2,FrameStyle->None,RoundingRadius->5,Background->m8red[1]],Row[{Framed[Style[header,"LargeOverviewSection",White],FrameMargins->{{15,15},{5,5}},FrameStyle->None,RoundingRadius->5,Background->m8red[1]]," » ",Framed[Style[subs,"LargeOverviewSection"],FrameMargins->{{15,15},{5,5}},FrameStyle->m8red[1],BoxFrame->2,RoundingRadius->5,Background->White]}]]]],"LargeOverviewSection"]

SetDirectory

SetDirectory@NotebookDirectory[];

$Line

$Line=0;

Scratchpad

Button[Panel@Show[,ImageSize->1->1],SystemOpen["ExampleLecture.pdf"]]

Import["C:\\Users\\mmorrison\\Desktop\\3-15-2013 9-25-29 PM.png"]

ImageResize[,200]

Button[Panel@Show[,ImageSize->1->1],SystemOpen["vvw-reg-report-2013-embed.cdf"]]

Import["C:\\Users\\mmorrison\\Desktop\\CDFPlayer.png"]//ImageTake[#,{0,198},{0,342}]&;

ImageTake[,{5,195},{2,340}]

ImagePad[,{{1,1},{1,1}},GrayLevel[0.8]]

ImageResize[,200]

Import["C:\\Users\\mmorrison\\Desktop\\3-16-2013 12-22-06 PM.png"];

ImageTake[,{5,195},{2,340}]

ImagePad[,{{1,1},{1,1}},GrayLevel[0.8]]

ImageResize[,200]

Import["C:\\Users\\mmorrison\\Desktop\\mathematica.png"];

ImageTake[,{5,195},{2,340}]

ImagePad[,{{1,1},{1,1}},GrayLevel[0.8]]

ImageResize[,200]