Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Imad E. , script perl pour generer les rotations et les mirroires d'une image
- # faire l'opération XOR entre les différentes images ..
- #La fonction Roter pour génerer les images ( version programmeur ( pas d'options ) )
- #La fonction XORER pour faire le xor ( version programmeur ( pas d'options ) )
- use GD::Image;
- $image_0 = newFromPng GD::Image('enigma.png');
- ($width,$height) = $image_0->getBounds();
- sub XORER
- {
- $image_1 = newFromPng GD::Image('enigm_90.png'); #Rotation 90
- $image_2 = newFromPng GD::Image('enigm_180.png');
- $image_3 = newFromPng GD::Image('enigm_270.png');
- $image_4 = newFromPng GD::Image('enigm_hor.png'); #miroire horiz
- $image_5 = newFromPng GD::Image('enigm_ver.png'); #miroire vertical
- $result= newFromPng GD::Image('imad_t.png');
- print "[+]Processing the $width x $height image. . . \n";
- for (my $h=0;$h<$height;$h++)
- {
- for (my $w=0;$w<$width-512;$w++)
- {
- $index_0 = $image_0->getPixel($w,$h);
- $index_1 = $image_1->getPixel($w,$h);
- $index_2 = $image_2->getPixel($w,$h);
- $index_3 = $image_3->getPixel($w,$h);
- $index_4 = $image_4->getPixel($w,$h);
- $index_5 = $image_5->getPixel($w,$h);
- $index_6 = $image_0->getPixel($w,$h); #pour un décalage à moitié ajouter $width/2 ou $height/2
- $index= ( $index_0 ^ $index_6 );
- $result->setPixel($w,$h,$index);
- }
- }
- $png_data = $result->png;
- open ($D,">",'result.png') ;
- binmode $D;
- print $D $png_data;
- close $D;
- `result.png`;
- }
- sub ROTER
- {
- $image_1 = newFromPng GD::Image('imad_t.png');
- $image_2 = newFromPng GD::Image('imad_t.png');
- $image_3 = newFromPng GD::Image('imad_t.png');
- $image_4 = newFromPng GD::Image('imad_t.png');
- $image_5 = newFromPng GD::Image('imad_t.png');
- print "[+]Processing the $width x $height image. . . \n";
- for (my $h=0;$h<$height;$h++)
- {
- for (my $w=0;$w<$width;$w++)
- {
- $index_2 = $image_0->getPixel($w,$h);
- $image_1->setPixel($h,$width-$w,$index_2); #ROT 90
- $image_2->setPixel($width-$w,$height-$h,$index_2); #ROT 180
- $image_3->setPixel($height-$h,$w,$index_2); #ROT 270
- $image_4->setPixel($w,$height-$h,$index_2); #MIROR VERT
- $image_5->setPixel($width-$w,$h,$index_2); #MIROR HORI
- open ($D_90,">",'enigm_90.png') ;open ($D_180,">",'enigm_180.png') ;open ($D_270,">",'enigm_270.png') ;
- open ($D_HOR,">",'enigm_hor.png') ;open ($D_VERT,">",'enigm_ver.png') ;
- binmode $D_90;binmode $D_180;binmode $D_270;binmode $D_HOR;binmode $D_VERT;
- $png_data = $image_1->png;print $D_90 $png_data;
- $png_data = $image_2->png;print $D_180 $png_data;
- $png_data = $image_3->png;print $D_270 $png_data;
- $png_data = $image_4->png;print $D_VERT $png_data;
- $png_data = $image_5->png;print $D_HOR $png_data;
- close $D_90;close $D_180;close $D_270;close $D_HOR;close $D_VERT;
- `enigm_90.png`;
- `enigm_180.png`;
- `enigm_270.png`;
- `enigm_hor.png`;
- `enigm_ver.png`;
- }
- &XORER;
- #&ROTER;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement