Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^7: Very Large Hex Combinations

by Anonymous Monk
on Aug 05, 2005 at 11:15 UTC ( [id://481193]=note: print w/replies, xml ) Need Help??


in reply to Re^6: Very Large Hex Combinations
in thread Very Large Hex Combinations

The program below will get you started. It generates all 8x8 images using just black and white pixels, storing them in PBM format, requiring only 15 bytes per file.

Without counting overhead of inodes and directories, you only need to solve the *minor* *minor* *minor* storage issue of 257,698,037,760 Tb.

On my computer, it took more than an hour to generate all 3x8 bitmaps. Rounding that down to an hour, an estimate to do all 8x8 bitmaps is 125 million years.

That's 125 million years for an image consisting of a mere 64 bits. A 480x640 bitmap contains 307200 bits, the full colour version 7372800 bits. Realizing that a single bit more means doubling of your computer time you must come to the conclusion your quest is unfeasable.

Really, it's cheaper to just subscribe to the porn sites instead of generating your smut images this way.

Here's the code:

#!/usr/bin/perl use strict; use warnings; my $dir = "/tmp"; foreach my $r1 (0x00 .. 0xFF) { my $d1 = sprintf "$dir/%02X", $r1; mkdir $d1 or die "mkdir $d1: $!\n"; foreach my $r2 (0x00 .. 0xFF) { my $d2 = sprintf "$d1/%02X", $r2; mkdir $d2 or die "mkdir $d2: $!\n"; foreach my $r3 (0x00 .. 0xFF) { my $d3 = sprintf "$d2/%02X", $r3; mkdir $d3 or die "mkdir $d3: $!\n"; foreach my $r4 (0x00 .. 0xFF) { my $d4 = sprintf "$d3/%02X", $r4; mkdir $d4 or die "mkdir $d4: $!\n"; foreach my $r5 (0x00 .. 0xFF) { my $d5 = sprintf "$d4/%02X", $r5; mkdir $d5 or die "mkdir $d5: $!\n"; foreach my $r6 (0x00 .. 0xFF) { my $d6 = sprintf "$d5/%02X", $r6; mkdir $d6 or die "mkdir $d6: $!\n"; foreach my $r7 (0x00 .. 0xFF) { my $d7 = sprintf "$d6/%02X", $r7; mkdir $d7 or die "mkdir $d7: $!\n"; foreach my $r8 (0x00 .. 0xFF) { my $f8 = sprintf "$d7/%02X", $r8; open my $fh, ">", $f8 or die "open $f8: $!\n"; printf $fh "%s\n%d %d\n", "P4", 8, 8; print $fh pack "C8", $r1, $r2, $r3, $r4, $r5, $r6, $r +7, $r8; close $fh or die "close $f8: $!\n"; } } } } } } } } __END__

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://481193]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-03-19 05:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found