Almost all sprite sheets ripped from old games that you will find online contain images that have been rebuilt from the original, smaller (usually 8x8 or 16x16 pixels) tiles. Below is an image of a tile editor without the color paletted adjusted to illustrate what i'm saying.
So, to use those graphics in your game, you should have the sprite origins and sizes stored in some way, for performance's sake. But, if you still want to get the sizes programatically, do something along this pseudocode:
var current_line = 0
var current_column = 0
var top_line = current_line
var bottom_line = current_line
var left_column = current_column
var right_column = current_column
// rectangle(x, y, width, height)
rectangle bounds = new rectangle(left_column, top_line, right_column - left_column, bottom_line - top_line)
IsEmptyLine/Column determines if a line or column is entirely made of fully transparent pixels. Also keep in mind that this is a generic code, and won't work for special cases, like non-vertical sprite tiling.