# ============================================================= sub unique_colors_perl() { use Image::Magick; # my($debug, $raw, $xres, $yres, $xysize, $unique, $xysize, %e2at); $debug=0; %e2at = (); $raw='i:/exp/raw/pf-2015.0531-249465.pprgb.7360x4912.raw'; &time_event('init', \%e2at, $debug*0); # Initialize timing &time_event('PerlMagic Read Raw File', \%e2at, $debug*0); ($xres, $yres)=&fname_to_xyres($raw, $debug); $xysize=$xres . "x$yres"; # 7360x4912 # Create a new rgb48 with just the right size $im=Image::Magick->new(size=>"$xysize", type=>'TrueColor',\ depth=>16); $err=$im->Read(filename=>"RGB:$raw"); warn $err if $err; &time_event('Quantize', \%e2at, $debug*0); ($unique) = $im->Get('colors'); printf("Unique colors=%.6fM = %6.3f%%\n", $unique/1E6, $unique/(7360*4912)); &time_event('term', \%e2at, $debug*0); # Finalize timing &show_event(\%e2at, $debug*0); # Event timing } # End Unique_Colors_Perl(). NOTE: Bone-Nary: Special build for BoneHeads who can't \ make their own! :)