Re: JPEG and 72 dpi revisited...
Re: JPEG and 72 dpi revisited...
- Subject: Re: JPEG and 72 dpi revisited...
- From: Marcel Weiher <email@hidden>
- Date: Thu, 11 Sep 2003 18:20:22 +0100
On 7 Sep 2003, at 21:32, Nick Morris wrote:
[use NSBitmageImageRep, not NSImage]
This is true... However, if you save a NSBitmapImageRep to a JPEG, no
matter what the dpi of the image file that was used to create the
NSBitmapImageRep, you will end up with a 72 dpi image when saved as a
JPEG.
Not on my machine. The following program preserves the resolution of
the JPEG:
#import <Cocoa/Cocoa.h>
int main( int argc, char *argv[] )
{
id pool=[NSAutoreleasePool new];
id app=[NSApplication sharedApplication];
id data=[NSData dataWithContentsOfMappedFile:[NSString
stringWithCString:argv[1]]];
id rep=[[[NSBitmapImageRep alloc] initWith
Data:data]
autorelease];
id jpeg;
NSLog(@"rep=%@",rep);
jpeg = [rep representationUsingType:NSJPEGFileType
properties:nil];
[jpeg writeToFile:@"/tmp/out.jpg" atomically:YES];
}
Marcel
--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
1d480c25f397c4786386135f8e8938e4
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.