GetBitmap ?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 26/03/2011 at 06:03, xxxxxxxx wrote:

    Hi

    I want to get the pixel size of textures used in the scene.
    "BaseChan-> GetBitmap ()" I found it looking like functionality.
    To do a similar thing can I do?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 26/03/2011 at 06:32, xxxxxxxx wrote:

    import c4d  
      
    def main() :  
      mat = op.GetTag(c4d.Ttexture)[c4d.TEXTURETAG_MATERIAL]  
      if not mat:  
          print "No Tag"  
          return  
      try:  
          print mat[c4d.MATERIAL_COLOR_SHADER].GetSize()  
      except:  
          print "No Texture"  
      return  
      
    if __name__=='__main__':  
      main()
    

    I hope this snippet helps you.

    Cheers, nux



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 26/03/2011 at 15:01, xxxxxxxx wrote:

    Thanks nux.
    However, "mat" is "c4d.BaseList2D object" so "GetSize ()"function does not seem to have.

    def main() :    mat = doc.GetActiveMaterial()    print mat[c4d.MATERIAL_LUMINANCE_SHADER].GetSize()
    

    "GetSize ()" function when l is a good idea to use should I do?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 27/03/2011 at 16:04, xxxxxxxx wrote:

    You can't get the pixelsize of shaders since they do not have such one.

    Cheers,
    nux



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 28/03/2011 at 16:33, xxxxxxxx wrote:

    Here's an example of using the BaseBitmap class to get the size of an image:

    import c4d,os  
    from c4d import gui, bitmaps  
      
    def main() :  
      path = os.path.join("/Users", "user", "Desktop", "MyImage.jpg")# <-- Use you own path here  
      bmp = bitmaps.BaseBitmap(path)   
      bmp.InitWith(path)   
      
      
      x, y = bmp.GetSize() #Gets the X and Y dimensions of the image   
      
      print(x)  
      print(y)  
      
    if __name__=='__main__':  
      main()  
    

    -ScottA



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 29/03/2011 at 04:23, xxxxxxxx wrote:

    Thanks ScottA.
    I was able to get the pixel size !


Log in to reply