in reply to A data selection problem(in3D).
Hi,
Do you have to select or can you generate?
My idea is use the color picker tool to pick the 5 colors from the image you like, and then generate the colors inbetween, with total amount of steps that adds up to 256,
like this "black body" colormap used is for photoshop fire effect
code
sub BlackBody { ColormapHtml( BlackBodyMap() ); ColormapHtml( GreyscaleMap() ); } sub ColormapHtml { my $blackbody = shift; print "<table>"; while(@$blackbody){ print "<tr>"; #~ for(1..8){ #~ for(1..16){ for(1..32){ my $color = shift @$blackbody; #~ my $hex = join '', map { pack 'H*', $_ } @$color; my $hex = rgb2hex( @$color ); #~ print qq[<td bgcolor="#$hex"><font color="#$hex">$hex</ +font></td>]; print qq[<td bgcolor="#$hex"><font color="#$hex">_</font>< +/td>]; } print "</tr>"; } print "</table>"; } sub rgb2hex { #~ my( $r, $g, $b ) = @_; sprintf '%02x%02x%02x', @_; } sub BlackBodyMap { my $one = [ 255, 0, 0 ] ; my $two = [ 255, 255, 0 ]; my @colormap = ( YuckFoo( 85, [0,0,0] => $one ), YuckFoo( 85, $one => $two ), YuckFoo( 86, $two => [255,255,255] ), ); return \@colormap; } sub GreyscaleMap { return [ YuckFoo(256, [0,0,0] => [255,255,255] ) ]; } sub YuckFoo { my( $steps, $beg, $end) = @_; # RGB rate of change from beginning to ending color my @delta = ( ($$end[0] - $$beg[0]) / ($steps-1), ($$end[1] - $$beg[1]) / ($steps-1), ($$end[2] - $$beg[2]) / ($steps-1), ); # Calculate colors using beginning color and rate of change my $i = 0; my @gradient; while($i < $steps) { my $color = [ $$beg[0] + $i * $delta[0], $$beg[1] + $i * $delta[1], $$beg[2] + $i * $delta[2] ]; push @gradient, $color; $i++; } return @gradient; }
| _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ |
| _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ |
| _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ |
| _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ |
| _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ |
| _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ |
| _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ |
| _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ |
| _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ |
| _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ |
| _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ |
| _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ |
| _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ |
| _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ |
| _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ |
| _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ | _ |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: A data selection problem(in3D).
by BrowserUk (Patriarch) on Apr 06, 2017 at 11:29 UTC |