We are developing a game on UnrealEngine4 and we need the PNG representation of a SF Symbol to display it on our UI.
After watching WWDC sessions and reading the documentation, we achieved it by calling:
However, it outputs an image of 18x14 pixels. We need an image of size 64x64 pixels.
How can we resize it before getting the PNG representation so it can be displayed larger on the screen?
After watching WWDC sessions and reading the documentation, we achieved it by calling:
Code Block NSImage* nsImage = [NSImage imageWithSystemSymbolName:symbolNameString accessibilityDescription:nil]; NSImageSymbolConfiguration* config = [NSImageSymbolConfiguration configurationWithPointSize:100 weight:NSFontWeightBlack scale:NSImageSymbolScaleLarge]; NSImage* nsImageWithConfig = [nsImage imageWithSymbolConfiguration:config]; NSData* tiff = [nsImageWithConfig TIFFRepresentation]; NSBitmapImageRep* raw_img = [NSBitmapImageRep imageRepWithData:tiff]; NSDictionary* dict = [NSDictionary dictionary]; NSData* nsData = [raw_img representationUsingType:NSBitmapImageFileTypePNG properties:dict];
However, it outputs an image of 18x14 pixels. We need an image of size 64x64 pixels.
How can we resize it before getting the PNG representation so it can be displayed larger on the screen?