Last active
December 17, 2018 07:25
-
-
Save loops/b3a9e16e2cd0d73ebf44551ce84ccb6a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env perl6 | |
use lib 'lib'; | |
use Graphics::TinyTIFF; | |
use NativeCall; | |
# changed your library away from blob to this: | |
# | |
# sub TinyTIFFReader_getSampleData( TinyTIFFReaderFile is rw, CArray[uint16] is rw, uint16 ) | |
# | |
# Didn't change anything else. And then this worked: | |
my TinyTIFFReaderFile $x = TinyTIFFReader_open('test16m_imagej.tif'); | |
my $w = TinyTIFFReader_getWidth($x); | |
my $h = TinyTIFFReader_getHeight($x); | |
my $size = $w * $h; | |
say "size $w x $h"; | |
my @image := CArray[uint16].allocate($size); | |
say TinyTIFFReader_getSampleData($x, @image, 0); | |
if TinyTIFFReader_wasError($x) { | |
say "ERROR :("; | |
say TinyTIFFReader_getLastError($x); | |
} else { | |
# print "{@image[$_]} " for ^$size; | |
# Data for image is in @image ! | |
} | |
TinyTIFFReader_close($x); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks !!!