403Webshell
Server IP : 82.208.35.60  /  Your IP : 216.73.216.238
Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31
System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64
User : studiokobylisy_cz ( 1008)
PHP Version : 7.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/ports/science/py-fresnel/files/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/ports/science/py-fresnel/files/example.py
# the example is taken from https://fresnel.readthedocs.io/en/stable/examples/00-Basic-tutorials/00-Introduction.html
# image display is altered to use PIL

## generate image

import fresnel

scene = fresnel.Scene()

geometry = fresnel.geometry.Sphere(scene, N=8, radius=1.0)

geometry.position[:] = [[1,1,1],
                        [1,1,-1],
                        [1,-1,1],
                        [1,-1,-1],
                        [-1,1,1],
                        [-1,1,-1],
                        [-1,-1,1],
                        [-1,-1,-1]]


geometry.material = fresnel.material.Material(color=fresnel.color.linear([0.25,0.5,0.9]),
                                              roughness=0.8)
scene.camera = fresnel.camera.Orthographic.fit(scene)

fresnel.preview(scene)

fresnel.preview(scene, anti_alias=False)

fresnel.pathtrace(scene)

fresnel.pathtrace(scene, light_samples=40)

out = fresnel.preview(scene)
print(out[:].shape)
print(out[:].dtype)

import PIL

image = PIL.Image.fromarray(out[:], mode='RGBA')
image.save('output.png')

image = PIL.Image.fromarray(out[:,:,0:3], mode='RGB')
image.save('output.jpeg')


## display image

from PIL import Image

im = Image.open('output.png')
im.show()

im = Image.open('output.jpeg')
im.show()

Youez - 2016 - github.com/yon3zu
LinuXploit