UIImage size method before save it

Discussion in 'iPhone' started by carlosl3g, Jan 12, 2009.

  1. carlosl3g macrumors newbie

    Joined:
    Oct 21, 2008
    #1
    Hi, is it posible to do that?:

    Code:
    NSLog(@"SIZE OF IMAGE: %d ", sizeof(UIImageJPEGRepresentation((imageView.image), 0.5)));
    because I got 4 as answer so I think it's a pointer.

    How could I get an image size if I don't have the path yet?
    I've seen:

    Code:
    - (NSDictionary *)attributesOfItemAtPath:(NSString *)patherror:(NSError **)error
    but I need the size before the image is saved.


    Thaks for your help.
     
  2. carlosl3g thread starter macrumors newbie

    Joined:
    Oct 21, 2008
    #2
    There is a property that returns the size like:

    805300712

    but this is a CGSize wich is actually widht and heigh and I want to get the size in bytes.
     
  3. carlosl3g thread starter macrumors newbie

    Joined:
    Oct 21, 2008
    #3
    It's OK I've found it:

    Code:
    NSData *imageData = [[NSData alloc] initWithData:UIImageJPEGRepresentation((imageView.image), 0.5)];
    	int imageSize = imageData.length;
    	NSLog(@"SIZE OF IMAGE: %i ", imageSize);
    	if( imageSize > 0)
     

Share This Page