there is no function in the API that does what you want. You have to write that function yourself.
GeClipMap is a class you can use to load image data. Then you can simply check each pixel of that image if it relevant for you:
selectedImageFile = c4d.storage.LoadDialog(type=c4d.FILESELECTTYPE_IMAGES, title="Select Image")
if not selectedImageFile:
sourceClipMap = c4d.bitmaps.GeClipMap()
res = sourceClipMap.InitWith(selectedImageFile,-1)
width = sourceClipMap.GetBw()
height = sourceClipMap.GetBh()
for y in xrange(height):
for x in xrange(width):
r,g,b,a = sourceClipMap.GetPixelRGBA(x,y)
if a > 0.0:
print("X: " + str(x))
print("Y: " + str(y))
print("Pixel Alpha > 0.0")
You can simply memorize the "bouding box" in pixel size. With that information you can do what you want. But what do you mean with "trim"? Do you want to create a new bitmap with only the relevant information? Or do you want to create a polygon that only shows the relevant part of the bitmap? The last case can be achieved by simply adapting the polygons's UV coordinates.