mfi@serc.cis.ufl.edu (Mark Interrante) (03/18/91)
Can the workspace make aliases? How do I use the keyboard to change between file lists in the Open Panel? Is there a keystroke that will make the top window the key window? I found the cmd-"up arrow" which rotates you through the main windows, now I just want to "activate" one of those other applications. Did anyone notice in the announcement of the Colorstation that they said the all systems will use the jpeg compression routines. Does this mean that jpeg is included in 2.1? ----------------------------------------------------------------------------- Mark Interrante Software Engineering Research Center mfi@beach.cis.ufl.edu CIS Department, University of Florida 32611 ----------------------------------------------------------------------------- Quote from a west Texas farmer "status quo is Latin for the mess we're in."
aozer@next.com (Ali Ozer) (03/20/91)
In article <27488@uflorida.cis.ufl.EDU> mfi@serc.cis.ufl.edu () writes: >Did anyone notice in the announcement of the Colorstation that they >said the all systems will use the jpeg compression routines. Does >this mean that jpeg is included in 2.1? JPEG is actually included in 2.0. NeXTstep 2.0 has the ability to read and write JPEG files conforming to the JPEG TIFF draft as of the time 2.0 became available. The only app which provided the means to create JPEG files under 2.0 is Icon. Unfortunately it does not let you specify a compression factor; it uses a default value of 10. Also only files which are 4 or 8 bits deep per sample (color or grayscale) can be saved using JPEG. All apps running under 2.0 should let you read JPEG TIFF files. To incorporate JPEG compression in your program, you can use the - writeTIFF:(NXStream *)stream usingCompression:(int)compression andFactor:(float)compressionFactor; method in NXBitmapImageRep. Here's a small command-line program which lets you save a TIFF file as JPEG. "cc jpegcomp.m -lNeXT_s -lsys_s" and you're on your way. (This minimal program is meant to be an example only of how to use this stuff; it's not your ideal app...) Ali, Ali_Ozer@NeXT.com ---- jpegcomp.m -------------8<--------------------------------------------- #import <appkit/tiff.h> #import <appkit/NXBitmapImageRep.h> #import <stdio.h> #import <libc.h> main(int argc, char **argv) { id image; if (((argc == 2) || (argc == 3)) && (image = [NXBitmapImageRep newFromFile:argv[1]]) && (([image bitsPerSample] == 4) || ([image bitsPerSample] == 8))) { NXStream *s; float factor = (argc > 2) ? atof(argv[2]) : 0; if (s = NXOpenMemory (NULL, 0, NX_READWRITE)) { NX_DURING { if (factor <= 1.0) { [image writeTIFF:s usingCompression:NX_TIFF_COMPRESSION_JPEG]; } else { [image writeTIFF:s usingCompression:NX_TIFF_COMPRESSION_JPEG andFactor:factor]; } NXFlush (s); NXSaveToFile (s, "jpegout.tiff"); printf ("Output written as jpegout.tiff\n"); } NX_HANDLER { printf ("Error while saving...\n"); } NX_ENDHANDLER NXCloseMemory (s, NX_FREEBUFFER); } [image free]; } else { printf("Usage: %s tifffile [factor]\n",argv[0]); } }