vips

libvips perlin to rgb


Using NetVips,

    using var per = Image.Perlin(800,800,33,true,3434);
    using var per2 = Image.Perlin(800,800,13,true,3435);
    using var per3 = Image.Perlin(800,800,13,true,3435);

    using var comp = per.Composite(new []{per2, per3},new []{Enums.BlendMode.ColourBurn, Enums.BlendMode.Lighten},compositingSpace:Enums.Interpretation.Rgb);

yeilds

Exception has occurred: CLR/NetVips.VipsException
An unhandled exception of type 'NetVips.VipsException' occurred in NetVips.dll: 'unable to call composite
vips_colourspace: no known route from 'b-w' to 'rgb''

not sure how to get image from perlin, b-w to rgb basically.


Solution

  • Try using sRGB instead of RGB, you should get an image.

    Though it'll be black and white since you are compositing black and white images. Did you want to join the three perlin images together as RGB? You need bandjoin, eg. in Python:

    #!/usr/bin/python3
    
    import pyvips
    
    per1 = pyvips.Image.perlin(800, 800, cell_size=33, uchar=True, seed=3434)
    per2 = pyvips.Image.perlin(800, 800, cell_size=13, uchar=True, seed=3435)
    per3 = pyvips.Image.perlin(800, 800, cell_size=13, uchar=True, seed=3435)
    
    # join the three one-band images up as a three-band image, tag as sRGB
    image = per1.bandjoin([per2, per3]).copy(interpretation="srgb")
    
    image.write_to_file("x.png")
    

    To make:

    enter image description here