Web2.0-generated wallpapers

blog pag background

Blog page background header

I decided to create a backround header image for my blog and Multiply page. Tons of randomly writter equations would be nice to have. The Yahoo Image search allows you to specify if you the types of pictures you want like black and white photos, image size, etc. I used the yahoo_collage.pl from Uppal’s blog and modified it to exceed the maximum images per query of 50 limit from Yahoo’s image search api. Below is the patch:

*** yahoo_collage.pl	2005-09-16 20:07:50.000000000 -0500
--- ycollage.pl	2008-08-13 13:56:45.000000000 -0500
***************
*** 1,4 ****
! #! /usr/local/bin/perl -w
  ################################################################################
  # Yahoo Image Search Collage Generator
  #
--- 1,4 ----
! #! /usr/bin/perl -w
  ################################################################################
  # Yahoo Image Search Collage Generator
  #
*************** my $count   = 50;
*** 33,38 ****
--- 33,39 ----
  my $file    = undef;
  my $width   = 50;
  my $height  = 50;
+ my $init = 0;

  GetOptions(
      'query=s'   => \$query,
*************** GetOptions(
*** 41,46 ****
--- 42,48 ----
      'width=i'   => \$width,
      'height=i'  => \$height,
      'help'      => \$help,
+     'init=i'      => \$init,
  );

  if ($help) {
*************** if ($help) {
*** 56,71 ****

  die("Must specify a query!\n") unless ($query);

! if ($count > Yahoo::Search::MaxCount('Image')) {
!     die("Yahoo! does not allow querying for more than " .
!         Yahoo::Search::MaxCount('Image') . " results at once!\n");
! }

  print STDERR "Querying Yahoo for \"$query\"...\n";
! my @results = Yahoo::Search->Results(
      Image => $query,
!     Count => $count,
! );

  print STDERR "Generating HTML...\n";
--- 58,86 ----

  die("Must specify a query!\n") unless ($query);

! #if ($count > Yahoo::Search::MaxCount('Image')) {
! #    die("Yahoo! does not allow querying for more than " .
! #        Yahoo::Search::MaxCount('Image') . " results at once!\n");
! #}

  print STDERR "Querying Yahoo for \"$query\"...\n";
! my $summary = Yahoo::Search->Query(
      Image => $query,
!     Count => "50",
! 	Start => $init,
! 	Color => "bw")->CountAvail;
! my $i;
! my @results;
! for($i = $init; $i < $count + $init; $i += 50)
! {
!     my @partial = Yahoo::Search->Results(
!         Image => $query,
! 		Start => $i,
!         Count => 50,
!         Color => "bw");
! 	push (@results, @partial);
! }
! print "Generated image $init to $i from $summary\n";

  print STDERR "Generating HTML...\n";
*************** sub generate_html {
*** 92,99 ****
      my $html_images = "";

      foreach my $image_result (@$ra_results) {
!         $html_images .= "<a href=\"" . $image_result->HostUrl() . "\"> <img src=\"" .
!                         $image_result->ThumbUrl() . "\" width=$width height=$height></a>";
      }

      my $html_credits = qq{Created with <a href="http://upster.blogspot.com">Siddharth Uppal</a>'s
--- 107,114 ----
      my $html_images = "";

      foreach my $image_result (@$ra_results) {
!         $html_images .= "<img src=\"" .
!                         $image_result->ThumbUrl() . "\" border=0> ";
      }

      my $html_credits = qq{Created with <a href="http://upster.blogspot.com">Siddharth Uppal</a>'s
*************** sub generate_html {
*** 104,120 ****
      my $html_page = qq{
          <html>
          <head>
!         <title>Yahoo Image Search Collage Generator: $query</title>
          </head>
!         <body><center>
!         <font face="Trebuchet MS" color="Black" size="4"><b>$query</b></font><br>
!         <p align="center">$html_images</p>
!         <font face="Trebuchet MS" color="Black" size="2"><br><b>
!         To show off your collage, just copy and paste the text below into your blog or website!<br><br>
!         <textarea rows="25" cols="50">$html_images<br>$html_credits</textarea><br><font size="1"
!         face="Verdana" color="Gray">
!         </b><br>$html_credits
!         </center></body>
          </html>
      };

--- 119,129 ----
      my $html_page = qq{
          <html>
          <head>
!         <title>$query</title>
          </head>
!         <body style="width: 1024px;">
! 		<p align="center">$html_images</p>
!         </body>
          </html>
      };

Here are some selected of my generated collages:

latex equation

latex equation

modulator

modulator

0 Responses to “Web2.0-generated wallpapers”



  1. コメントする

コメントを残す

以下に詳細を記入するか、アイコンをクリックしてログインしてください。

WordPress.com ロゴ

WordPress.com アカウントを使ってコメントしています。 ログアウト / 変更 )

Twitter 画像

Twitter アカウントを使ってコメントしています。 ログアウト / 変更 )

Facebook の写真

Facebook アカウントを使ってコメントしています。 ログアウト / 変更 )

Google+ フォト

Google+ アカウントを使ってコメントしています。 ログアウト / 変更 )

%s と連携中





%d人のブロガーが「いいね」をつけました。