NSImage and PNG's
I have a simple Cocoa app that loads and displays a texture. The view that it is displayed in is 1024 by 512 because that is most likely the dimensions of the images that I'll be working with. I have a PNG file that opens up in Preview as 1024x512, in other apps as such, and the Finder indicates that that's the size of it as well. For some reason,
imageSize is 458 by 229 every time. I tried resaving it, no change but when I saved it as a TGA file, it loads and displays correctly.
All of the images I'll be receiving will be in PNG format because they'll be loaded into the iPhone. I could convert them all but it would be nice if I didn't have to. Does anyone know why PNG files are loading like that? Thanks in advance.
Code:
NSImage *image = [[NSImage alloc] initWithContentsOfFile:texturePath];
NSSize imageSize = [image size];imageSize is 458 by 229 every time. I tried resaving it, no change but when I saved it as a TGA file, it loads and displays correctly.
All of the images I'll be receiving will be in PNG format because they'll be loaded into the iPhone. I could convert them all but it would be nice if I didn't have to. Does anyone know why PNG files are loading like that? Thanks in advance.
If you have control over the images you're loading, try this: http://www.nothings.org/stb_image.c
It's the least cumbersome image loader I've run across and has no dependancies - just plop it in and go.
It's the least cumbersome image loader I've run across and has no dependancies - just plop it in and go.
Or you could just read the documentation and use the right API.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Basic NSImage drawing help please! | xenocide | 6 | 4,795 |
Feb 2, 2009 11:01 AM Last Post: FlamingHairball |
|
| NSImage PDF -> JPG | unknown | 3 | 3,345 |
Oct 23, 2005 08:36 PM Last Post: PowerMacX |
|
| How to get resolution of an NSImage or NSBitmapImageRep? | aegidian | 4 | 4,669 |
Oct 18, 2005 02:39 AM Last Post: aegidian |
|
| Help with NSImage and NSString... | Joseph Duchesne | 2 | 4,089 |
Sep 30, 2005 02:21 PM Last Post: unknown |
|
| NSImage -> Jigsaw peices | unknown | 5 | 3,333 |
Sep 29, 2005 07:00 AM Last Post: unknown |
|

