UIImage+Svga.m 501 B

123456789101112131415161718192021
  1. //
  2. // UIImage+Svga.m
  3. // SVGAPlayer-iOS
  4. //
  5. // Created by SuperC on 2024/2/2.
  6. //
  7. #import "UIImage+Svga.h"
  8. @implementation UIImage (Svga)
  9. -(UIImage *)imageByResizeToSize:(CGSize)size {
  10. if (size.width <= 0 || size.height <= 0) return nil;
  11. UIGraphicsBeginImageContextWithOptions(size, NO, self.scale);
  12. [self drawInRect:CGRectMake(0, 0, size.width, size.height)];
  13. UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
  14. UIGraphicsEndImageContext();
  15. return image;
  16. }
  17. @end