I am new to objective-c and cocoa programming. I am trying to generate image which will be 128mm in height and 128mm in width with 300 DPI resolution.
NSString *image = [[NSImage alloc] initWithSize:NSMakeSize(1512, 756)];
In above line of code 1512 and 756 are treated as points. So I am not able to convert it to what I need. It is creating image with (3024 * 1512) size.
Can you please suggest something... Thanks in advance.
Here is the code which I tried
NSImage *image = [[NSImage alloc] initWithSize:NSMakeSize(2268, 2268)];
[image lockFocus];
// Draw Something
[image unlockFocus];
NSString* pathh = @"/Users/abcd/Desktop/Images/1234.bmp";
CGImageRef cgRef = [image CGImageForProposedRect:NULL
context:nil
hints:nil];
NSBitmapImageRep *newRep = [[NSBitmapImageRep alloc] initWithCGImage:cgRef];
NSSize copySize; // To change to 600 DPI
copySize.width = 600 * [newRep pixelsWide] / 72.0;
copySize.height = 600 * [newRep pixelsWide] / 72.0;
[newRep setSize:copySize]; //This input is not working
NSData *pngData = [newRep representationUsingType:NSBMPFileType properties:nil];
[pngData writeToFile:pathh atomically:YES];