Question

Creating texture appearances with Python?

  • 18 May 2020
  • 1 reply
  • 4 views

Userlevel 4
Badge +26

Hi FME python experts,

 

 

I'm working on a problem where I have 3D objects returned from a python library. Thanks to @david_r and @gerhardatsafe's help I've been able to successfully port the geometries I need in most cases to FME Geoms which I'm super happy about.

 

 

Now I am trying to take it a step further and create the appearances - for non-textured appearances I've got a fairly decent working method, however, for textures the only way I've been able to get it to work is to dump the textures to files (JPEG/PNG) and then read them back in with FME before creating textured appearances and applying them with the SharedItemSetter. As you might imagine this is a little slower than I would like given the data are already in memory.

The images seem to be in the form of "PIL.image" ("C:\\Program Files\\FME\\python\\python37\\PIL\\Image.py")

 

Has anyone attempted this? Any hints on how I might be able to do it? It seems like the fmeobjects.FMETexture class ( https://docs.safe.com/fme/html/fmepython/api/fmeobjects/geometry/_appearances/fmeobjects.FMETexture.html ) has no clear way to set the actual texture data

 

 

 


1 reply

Userlevel 4
Badge +26

Just if anyone is interested,

 

 

I ended up creating a base64 string from the PIL.image (using this) and passed that out as a feature which I was then able to turn into a raster and then texture. Still not ideal but at least I don't have to dump the images and it's much faster.

 

 

 

Reply