Guest User

Untitled

a guest
Feb 21st, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. <?php
  2. // JPEG 2 ASCII
  3. $in = 'test.jpg';
  4. $out = 'test.html';
  5. $buf = '';
  6.  
  7. $gd = imagecreatefromjpeg($in);
  8. $w = imagesx($gd);
  9. $h = imagesy($gd);
  10. for($y=0; $y<$h; $y++){
  11. for($x=0; $x<$w; $x++){
  12. $rgb = imagecolorat($gd, $x, $y);
  13. $r = ($rgb >> 16) & 0xFF;
  14. $g = ($rgb >> 8) & 0xFF;
  15. $b = $rgb & 0xFF;
  16. $buf .= "<span style=\"color:rgb({$r},{$g},{$b});\">#</span>";
  17. if($w === $x+1){
  18. $buf .= '<br>';
  19. }
  20. }
  21. }
  22. echo "<div style=\"line-height:1px;font-size:1px;\">{$buf}</div>";
Add Comment
Please, Sign In to add comment