Thread View: sci.image.processing
2 messages
2 total messages
Started by Ilya Simovsky
Fri, 22 Jan 1993 18:43
conversion to xv formats
Author: Ilya Simovsky
Date: Fri, 22 Jan 1993 18:43
Date: Fri, 22 Jan 1993 18:43
9 lines
703 bytes
703 bytes
Dear gurus: Could anybody, please, advise me where I can find a program for UNIX to convert a 16 bit binary grayscale image (i.e a file with say 256*256 short int) to one of the following formats : GIF, JPEG, TIFF, PBM, PGM, PPM, X11 bitmap, Utah Raster Toolkit RLE, PDS/VICAR, Sun Rasterfile, PM. -- - Ilya ******************************************************************
Re: conversion to xv formats
Author: Steve Lamont
Date: Fri, 22 Jan 1993 22:17
Date: Fri, 22 Jan 1993 22:17
43 lines
1762 bytes
1762 bytes
In article <1993Jan22.184317.1411@igor.tamri.com> ilya@igor.tamri.com (Ilya Simovsky) writes:
>Dear gurus:
>Could anybody, please, advise me where I can find a program for UNIX to convert
>a 16 bit binary grayscale image (i.e a file with say 256*256 short int) to one
>of the following formats : GIF, JPEG, TIFF, PBM, PGM, PPM, X11 bitmap, Utah Raster Toolkit RLE, PDS/VICAR, Sun Rasterfile, PM.
#include <stdio.h>
/*
* Raw 16 bit to pgm "translator"
* Copyright abandoned.
*/
main()
{
short int inbuffer[256 * 256];
char outbuffer[256 * 256];
int i;
fread( inbuffer, sizeof( short int ), 256 * 256, stdin );
for ( i = 0; i < 256 * 256; i++ )
outbuffer[i] = inbuffer[i] >> 8;
printf( "P5\n256 256\n255\n" );
fwrite( outbuffer, sizeof( char ), 256 * 256, stdout );
exit( 0 );
}
Error checking and enhancements are left as an exercise for the student.
I mean, it ain't that difficult...
spl
--
Steve Lamont, SciViGuy -- (619) 534-7968 -- spl@szechuan.ucsd.edu
UCSD Microscopy and Imaging Resource/UCSD Med School/La Jolla, CA 92093-0608
"The English are drinking the better beer in Bavaria."
- Archibald Macleish, "Lines for an Interment"
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads