Announcing the Thumbnail Image Grabber
The Thumbnail Image Grabber is now available, at version 0.50. View the program’s page for more details.
something you might want to know
The Thumbnail Image Grabber is now available, at version 0.50. View the program’s page for more details.
This script hadn’t worked properly for a while. Its been tweaked so give it a try. It should work if you have drag-n-drop enabled or not, and works in both the normal and the instant queues.
A Netflix queue tends to show some clustering of movie types, due to the way people add one movie then add a similar suggested movie. If you want to restore some variety it can be tedious to move things around. Here’s a little tool to randomly re-order your Netflix queue.
This is another task well suited for a bookmarklet. The page layout is straightforward, and only needs to manipulate the values of input fields. The code can be implemented in a few hundred bytes, so only one version is required to support IE and Firefox, without resorting to script injection.
The queue items are in a form. There are 3x+2 input fields in the form; the first and last are the submit buttons. The other fields are triplet groups with the position field, original position (hidden), and the remove checkbox. Here is the code:
javascript: (function(){ var items=document.forms[1].getElementsByTagName('input'); var os=[]; for(i=0;i<items.length;i++){ if(items[i].className=='o'){ os.push(items[i]); } } var total=os.length; for(var i=0;i<total;i++){ os[i].value=Math.floor(Math.random()*total); } alert(total+'%20shuffled.%20%20Update%20Your%20Queue%20to%20save.'); } )()
Here is the bookmarklet link:
Netflix Shuffler
Add this to your bookmarks/favorites by right-clicking or dragging it to the toolbar. To use it just navigate to your Netflix queue page and select the bookmarklet. The queue will be shuffled, then just click Update Your Queue to commit the changes.
Here is a slightly modified version that simply reverses the queue order. This might be useful if all the new releases are at the end and you want to see those first.
javascript: (function(){ var items=document.forms[1].getElementsByTagName('input'); var os=[]; for(i=0;i<items.length;i++){ if(items[i].className=='o'){ os.push(items[i]); } } var total=os.length; for(var i=0;i<total;i++){ os[i].value=total-i; } alert(total+' reversed. Update Your Queue to save.'); } )()
Here is the bookmarklet link:
Netflix Reverser
Previously we showed how to pull GPS waypoints from MSN Yellow Pages and Google Maps results using a Firefox bookmarklet. Now this can be done with Internet Explorer as well. The original solution was inadequate because of the IE limit on the length of bookmarks.
To support IE the bookmarklets must be implemented using the ‘script injection’ technique. This involves rewriting the head of the HTML page to add a reference to an external script. The external script can be as long as needed. The drawback is that the external script must be fetched before the bookmarklet can do its job. This adds a small delay, and a dependency on the site hosting the script. So for Firefox users the standalone bookmark is probably preferable.
The new bookmarklets simply contain the code necessary to inject the external script into the page. Just right-click or drag them to add to your favorites/bookmarks. To use them visit the appropriate page and select the bookmark.
Here is the new MSN bookmarklet, and the code:
javascript: (function(){ var script=document.createElement('script'); script.src='http://badsegue.org/samples/msngpxrip.js'; document.getElementsByTagName('head')[0].appendChild(script); } )()
Here is the new Google bookmarklet, and the code:
javascript: (function(){ var script=document.createElement('script'); script.src='http://badsegue.org/samples/googgpxrip.js'; document.getElementsByTagName('head')[0].appendChild(script); } )()
The code of the actual extractor has changed a little bit. The Google extractor has to account for DOM differences to get to the data. Notice that the function is invoked at the end of the script, and not in the bookmarklet. This ensures that the function is defined by the time it is called.
function googrip(){ var t; if (document.vp && (t=document.vp.document.scripts[0].text)) {} else if (document.getElementById('vp') && (t=document.getElementById('vp'). contentDocument.getElementsByTagName('SCRIPT').item(0).text)) {} else { alert ("Nothing found here. Are you at maps.google.com? You are at " + document.location); return(0); } var pts=t.match(//g); if (pts) { ... extraction code removed. see previous articles... } else { alert ("Nothing found here.") } } googrip();
These bookmarklets may or may not work with Firefox. It does work for me when I use Firefox from home, but not at work. Theoretically these particular scripts shouldn’t work, because they attempt to open a new browser window. According to the Mozilla documentation, scripts or pages loaded from one domain can’t manipulate pages loaded from another domain. So if you encounter problems using these scripts, just use the ones shown in the earlier articles.
You’ve probably seen photomosaics before.
These are images that are composed of other images. There are several free/cheap programs out there that can take a given picture and make a mosaic using a set of pictures of your choosing. The one I’ve used and had great results with is AndreaMosaic. It’s free and easy to use.
Here’s a sample mosaic I made. This is a scaled down version of the original, which is around 8MB. The original image is only 70×70, and the component images are thumbnail sized, around 100×100.
You don’t need high resolution images to make a mosaic, but the resulting image can have enough detail to produce poster sized prints. I’ve made 24×30 prints using nothing more than low resoultion source image and a bunch of thumbnails.
Once you figure out the basic approach and dimensions needed for the final images, you can be producing mosaics in a matter of minutes. The hardest part is coming up with enough feeder images to give the mosaic enough
If you’ve got hundreds or thousands of images and you want to use those in the mosaic then you may not need to find any more feeder images. I like to use images related to the original’s subject matter, rather than just any image (although that can be interesting as well). So for the holiday dog picture I wanted holiday and dog pictures. The natural place to look was Google Images. You can search on anything and find any number of relevant images, and in thumbnail size from the results page. Since thumbnails are the perfect size for feeding into the mosiac there is no need to go to the host page and download the full-size version.
This Perl program takes a search term and a range, then fetches the matching images from Google Images. It saves them into a folder with the same name as the search term, in your current directory. The images are saved using the URL of the image, so if you re-run the search it won’t fetch an image it’s already stored.
Usage: get.pl
search term: This is the query string passed to Google Images. It can be whatever you want, but if it is more than one word then you have to put the term in quotes. You can use the Google query language, like "flower AND rose", "rose -wine", etc.
start range: The starting index to retrieve. Google returns 20 images per page, so this will start retrieving the page that contains the start range image.
end range: The ending index to retrieve. The program will stop once it retrieves the page that contains the end range image.
Use start-end to control how many images to fetch. Usually you will just do something like
get.pl "flower" 0 100
If you later wanted to get more images of that type you can do
get.pl "flower" 100 500
This will avoid the images you’ve already retrieved and save you some time.
Because you’re only downloading the thumbnails the program is usable even on dial-ups.
use HTML::Parser; use HTTP::Request::Common; use LWP; use URI::Escape; use strict; $|=1; my $client = LWP::UserAgent->new(agent=>'Mozilla', timeout=>'0', keep_alive=>1); my $ua = "Mozilla"; my $in = "./"; my $query = shift; chomp($query); my $start_idx = shift; chomp($start_idx); my $end_idx = shift; chomp($start_idx); my $url = "http://images.google.com/images?q=$query+filetype:jpg\&safe=off"; my $start = $start_idx || "0"; my $stop = $end_idx || 0; my $dest_dir = "$in/" . uri_escape ($query); my $count = 1; my $p = new HTML::Parser ( api_version => 3, start_h => [\&tag, "tagname, attr"], ); print "Start = $start, Stop = $stop, Query = $query\n"; mkdir $in || die "Couldn't make $in ($!)\n"; mkdir $dest_dir || die "Couldn't make $dest_dir ($!)\n"; while (1) { my $test = $start; # Get the search results page my $request = HTTP::Request->new('GET', "${url}\&start=${start}"); my $response = $client->request($request); $p->parse( $response->content ); # See if we are out of images if ($test == $start || ($stop && ($start >= $stop))) { print "Done.\n"; exit 0; } } sub tag { my ($tagname, $attr) = (@_); # Found the next page graphic, increment counter to continue grabbing if ($attr->{'src'} && ($attr->{'src'} eq "/nav_next.gif" )) { $start += 20; } return unless ($tagname eq 'img'); return unless ($attr->{'src'} && $attr->{'src'} =~ /images\?q=tbn:.*\.jpg/i); my $filename = $attr->{'src'}; $filename =~ s/\/images\?q=tbn:.*://; $filename = uri_escape($filename); if (-e "$dest_dir/$filename") { print "Skipping "; } else { my $request = HTTP::Request->new('GET', "http://images.google.com$attr->{'src'}"); my $response = $client->request($request, "${dest_dir}/${filename}"); } print "$filename (", $count++, ")\n"; }