Hello! plugincafe!
I want to save all material's preview image.
And i try to use BaseBitmap.ScaleIt() , but it's not working.
All images remain the before ScaleIt() size,I'm not sure what went wrong.
there are my code:
import c4d
def SetBmpSize(mats,size):
bmps = []
for m in mats:
image = m.GetPreview(0)
dst_bmp = c4d.bitmaps.BaseBitmap()
dst_bmp.Init(size, size)
image.ScaleIt(dst_bmp, 256, True, True)
bmps.append(image)
return bmps
def main():
path = "D:\\Program Files\\my folder"
mats = doc.GetMaterials()
bmps = SetBmpSize(mats,32)
for index,bmp in enumerate(bmps):
c4d.bitmaps.ShowBitmap(bmp)
#name = path + "\\" + str(index) + "material preview.tif"
#bmp.Save(name, c4d.FILTER_TIF, data=None, savebits=c4d.SAVEBIT_0)
if __name__=='__main__':
main()
this is the show in picture viewer after ScaleIt() Image: