My data is a slice []u8 of consecutive triplets {r,g,b} of u8. I want to transform this into a PNG image file.
I don’t see how to do this. My code below fails on the last line of image as built with fromRawPixels is probably wrong but I don’t see what else could I use.
var image = try zigimg.Image.fromRawPixels(allocator, w, h, pixels, .rgb24);
defer image.deinit();
print("check pixels: {}", .{pixels.len}); // w= 100 x h = 200 x 3 = 60_000 ok
try image.writeToFilePath("junk.png", .{ .png = .{} });
It’s not that the compiler is wrong, its that there is a version mismatch. It looks like zigimg latest targets the latest version of the compiler. There was a change into the names of the types in the std.builtin.Type enum between version 0.13 and 0.14.0.dev, where the names (like struct were changed from uppercase to lower case). You’ll need to get a version of the compiler that matches what zigimg supports.