Image of wire frame from 3Dgraph - can be exported

Is it possible to convert a wireframe graph with math into a transparent image and then export it to another site? The reason for this question is because I'm trying to snap a wireframe to a structure.

+1
source share
2 answers

The following code allows you to export to GIF with a transparent background (based on Mr.Wizard code):

g = Plot3D[{x^2 + y^2, -x^2 - y^2}, {x, -2, 2}, {y, -2, 2}, 
  RegionFunction -> Function[{x, y, z}, x^2 + y^2 <= 4], 
  BoxRatios -> Automatic, PlotStyle -> None, Axes -> None, 
  Boxed -> False]

Export["wireframetest.gif", g, Background -> White, 
 "TransparentColor" -> White]

This is how it appears in the Windows Image and Fax Viewer standard in Windows XP:

screenshot

, Graphics3D ( White) , GIF. , : Export - , RGB, 1/256.4971 ( 32- Windows XP Mathematica 8.0.1):

Rasterize[Graphics[{RGBColor[0, 0, 0], Disk[]}]] === 
 Rasterize[Graphics[{RGBColor[0, 0, 1/256.4971], Disk[]}]]
(*=> True*)

- , :

Export["wireframetest.gif", g, 
 Background -> RGBColor[1, 1, 0.996], 
 "TransparentColor" -> RGBColor[1, 1, 0.996]]

. , , :

neededColors = Union[Flatten[Rasterize[g, "Data"], 1]]

, ( ):

colorForBackground = 
 RGBColor @@ (First@
     Complement[Permutations[Range[0, 255], {3}], neededColors]/255)

:

Export["wireframetest.gif", g, Background -> colorForBackground, 
 "TransparentColor" -> colorForBackground]
+2

, , .

: PlotStyle -> None Background -> None.

g = Plot3D[{x^2 + y^2, -x^2 - y^2}, {x, -2, 2}, {y, -2, 2}, 
  RegionFunction -> Function[{x, y, z}, x^2 + y^2 <= 4], 
  BoxRatios -> Automatic, PlotStyle -> None, Axes -> None, Boxed -> False]

Export["wireframetest.png", g, Background -> None]

enter image description here

GIF, . . ( Mac OS X.)

+1

All Articles