How to set dpi of an image
How to set dpi of an image
- Subject: How to set dpi of an image
- From: Mahaboob <email@hidden>
- Date: Thu, 21 May 2009 12:59:35 +0530
- Thread-topic: How to set dpi of an image
I need to save the image with respect to the given dpi.
I calculated the image size proportional to the dpi and saved it.
But when I'm viewing the dpi from preview it shows only 72 dpi.
I used the code like:
float compressionFactor = [compressionSlider floatValue];
NSDictionary *jpegProperties = [NSDictionary dictionaryWithObject: [NSNumber
numberWithFloat: compressionFactor] forKey: NSImageCompressionFactor];
NSSize size = [image size];
unsigned int resfac = (unsigned int)[bitmapResolution intValue];
[image setScalesWhenResized:YES];
[image setSize:NSMakeSize(size.width * resfac/72, size.height *
resfac/72)];
NSBitmapImageRep *theBmapRep = [NSBitmapImageRep imageRepWithData:[image
TIFFRepresentation]];
NSData *exportedData;
exportedData = [ theBmapRep representationUsingType:NSJPEGFileType
properties:jpegProperties];
Is it I'm missing something?
How can I set the exact dpi?
Thanks in advance
Mahaboob
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden