• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: JPEG and 72 dpi revisited...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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] initWithData: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.

References: 
 >Re: JPEG and 72 dpi revisited... (From: Nick Morris <email@hidden>)

  • Prev by Date: Re: Newbie question - is where Obj-C analog for a C++ static data
  • Next by Date: Re: OT: Documentation for writing iPhoto Plug-ins
  • Previous by thread: Re: JPEG and 72 dpi revisited...
  • Next by thread: Textwindows
  • Index(es):
    • Date
    • Thread