Home > Geeky stuff, misc > Sucess exporting Tif files

Sucess exporting Tif files

I am still at work making images of the MO disks, but my perl script is complete! A whole 24 lines.   If anyone cares it will also be in the example code section.

#!/usr/bin/perl

$tiffname = “test3.dd”;
$test = “testout.dd”;
open(TIF, $tiffname) or die “can’t open $tiffname: $!”;
open(NEW, “>testout.dd”);
binmode(TIF);
binmode(NEW);
$enum = 0;
$oldbuff = 0;

while (read(TIF,$buff, 32)) {
if ($buff =~ m/II\*/ && $oldbuff =~ m/\x00\x00\x00\x00\x00\x00/) {
$enum++;
$formated = sprintf(“%09d”, $enum);
close NEW;
$new = “image” . $formated . “.tif”;
open (NEW, “>$new”);
print NEW $buff;
$oldbuff = $buff
}
else {
print NEW $buff;
$oldbuff = $buff
}
}

Advertisements
Categories: Geeky stuff, misc
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: