Get the correct image width and height of an NSImage

后端 未结 5 2068
北荒
北荒 2021-02-04 02:20

I use the code below to get the width and height of a NSImage:

NSImage *image = [[[NSImage alloc] initWithContentsOfFile:[NSString stringWithFormat:s]] autorelea         


        
5条回答
  •  不要未来只要你来
    2021-02-04 02:32

    NSImage size method returns size information that is screen resolution dependent. To get the size represented in the actual file image you need to use an NSImageRep.

    Refer nsimage-size-not-real-size-with-some-pictures link and get helped

提交回复
热议问题