Running my code, with the following function:
Code:
myNewData = [myTIFFasBitMap TIFFRepresentationUsingCompression: NSTIFFCompressionPackBits factor:0.0];
Produces a properly compressed tiff image (256k in size). However running my code with the following function instead:
Code:
myNewData = [myTIFFasBitMap TIFFRepresentationUsingCompression: NSTIFFCompressionCCITTFAX3 factor:0.0];
Produces a raw tiff file (1.8MBs, definatly NOT what I wanted). This compression method is supported according to Apple documentation (the unsuppored ones say they are not supported).
For a few more tests, I tried the following, as (suggested by someone on this list) to use in place of the TIFFRepresentationUsingCompression:
Code:
myDict = [NSDictionary dictionaryWithObject:@"NSTIFFCompressionPackBits " forKey:@"NSImageCompressionMethod"];
myNewData = [myTIFFasBitMap representationUsingType:NSTIFFFileType properties:myDict];
And I just get a raw tiff file (1.8MBs, defiantly NOT what I wanted). Changing the compression type to anything else just gives me the same result, raw tiff file.
So what have I learned.
-(NSData *)representationUsingType:properties: does nothing useful at all. It just gives me raw tiff files, no matter what compression I ask it to use. I also learned that TIFFRepresentationUsingCompression doesn't allow all the compressions it says it does (it only works with 3 out of the 8 or so listed).
So my question is now this. Are these not working because Apple has them set up for them not to work, or is something going wrong? I ask this because what I get from the documentation is that what is not working for me should work.