Oxaric’s Blog

A compendium of amazing things…

Posts Tagged ‘bmp’

Ruby Image Grabber

Posted by oxaric on December 7, 2008




Yesterday I coded an image grabber in Ruby. It takes a URL, gets the HTML file, and downloads every image it finds identified in the HTML file. It has one extra option that takes the minimum file size of a picture to download. It is not a web crawler and will not follow links to grab other images but I plan to create an image web crawler based upon this code and hopefully I’ll have that up soon.


Something to note is that it does not have the ability to download images referenced by php script. For example on certain forums images are displayed with php script and have a reference similar to “show.php?image_file_name.jpg”. This program will not travel to other links and so it is not able to download php referenced images.


However, if there is a gallery of images that has thumbnails with direct links to the bigger image this program will grab both images.


A neat feature is that the program takes into consideration special HTML codes and should have no problem with ‘coded’ URLs or foreign language image names.


Normally I’d put the source code up here but the program contains special ascii characters and the formatting for displaying the code isn’t working. I think it’s worth your time to download the program and give it a shot. ;)


Click to directly download grabimages.rb


More Information:


It grabs these image types:
.jpg
.jpeg
.png
.bmp
.gif
.tif
.tiff



Usage: ruby grabimages.rb [URL] [Download Path] [Option: Minimum Picture Size, in kB]


Usage Example:

~/test> ruby grabimages.rb www.yahoo.com download/


Posted in Programming, Ruby | Tagged: , , , , , , , , , , , , | Leave a Comment »

Bitmap Imaging

Posted by oxaric on November 20, 2008

I’m currently working on some code to detect text in images and it reminded me of an old project I created.


The program loads a 24-bit .bmp file and has code for a lot of different filters and transformations. Things like sun flares, swapping color levels, blurring, increasing color saturation, determining the number of colors in a picture and limiting the picture to a certain number of colors, and other things such as creating circles, lines, and squares.


At the time I had seen many different filters but I never knew about the algorithms to create these filters. So through trial and error I discovered ways to create the effects I wanted. It was a fun project and I’m glad I spent the time learning about imaging.


It’s not a finished project by any means and it doesn’t have very good commenting but it does has some neat features someone might want to look into. It has some tools that are useful such as bit manipulation and the bitmap loader.


I’m putting it up here more for posterity than anything else. I make no guarantees about how good it is. :)


Click to directly download ‘Imaging Program.zip’


Posted in C/C++, Programming | Tagged: , , , , , , , , | Leave a Comment »