Skip to main content

I would like to use the PIL module to resize an image stored in a blob (geodatabase attachment table) but I cannot create the Image object from the string representation in the pythonCaller

 

This is what I have tried so far:

import fme, fmeobjects
from PIL import Image
from io import StringIO
 
def processFeature(feature):
  string_io = StringIO(feature.getAttribute("data"))
  img = Image.open(string_io) #here I have the following error: Python Exception <OSError>: cannot identify image file <_io.StringIO object at 0x0000000007CE4438>
 
  img = img.resize((1000, int(round((width / float(img.sizeg0])) * img.size>1]))), Image.ANTIALIAS)

 

I have the following error Python Exception <OSError>: cannot identify image file <_io.StringIO object at 0x0000000007CE4438>

 

 

 

Why not simply use the RasterResampler transformer?


Why not simply use the RasterResampler transformer?

Thank you for your suggestion David!

I found out I needed to use the RasterReplacer first to get the raster from the blob field and finally the RasterExtractor to put it back into it.

fme_raster


Reply