Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIImage size in pixels

Can I get the pixel size for a UIImage if I just multiply the image.size with the image.scale ? Is it the same as doing this:

   guard let cgImage = image.CGImage else{
        return nil
    }
    let width = CGImageGetWidth(cgImage)
    let height = CGImageGetHeight(cgImage)
like image 453
the Reverend Avatar asked Feb 03 '16 20:02

the Reverend


1 Answers

Yes.

CGImageGetWidth and CGImageGetHeight will return the same size (in pixels) as returned by image.size * image.scale.

like image 52
rmaddy Avatar answered Oct 08 '22 02:10

rmaddy