#!/usr/bin/perl die "Usage: $0 filename\n" unless @ARGV == 1; my $file = shift; my $buf; open IN, $file or die "Can't read $file: $!\n"; while (read(IN, $buf, 4)) { print pack "N", unpack "V", $buf; } close IN; #### little2big little-endian.tif >big-endian.tif