<commit_before>//
//  RSImage-Extensions.swift
//  RSCore
//
//  Created by <NAME> on 4/11/19.
//  Copyright © 2019 Ranchero Software. All rights reserved.
//

import Foundation
import RSCore

extension RSImage {
	
	static let avatarSize = 48
	
	static func scaledForAvatar(_ data: Data, imageResultBlock: @escaping (RSImage?) -> Void) {
		DispatchQueue.global().async {
			let image = RSImage.scaledForAvatar(data)
			DispatchQueue.main.async {
				imageResultBlock(image)
			}
		}
	}
	
	static func scaledForAvatar(_ data: Data) -> RSImage? {
		
		let scaledMaxPixelSize = Int(ceil(CGFloat(RSImage.avatarSize) * RSScreen.mainScreenScale))
		guard let cgImage = RSImage.scaleImage(data, maxPixelSize: scaledMaxPixelSize) else {
			return nil
		}
		
		#if os(iOS)
		return RSImage(cgImage: cgImage)
		#else
		let size = NSSize(width: scaledMaxPixelSize, height: scaledMaxPixelSize)
		return RSImage(cgImage: cgImage, size: size)
		#endif
		
	}
	
}
<commit_msg>Fixed to use the correct width and height when creating the NSImage.  Issue #605<commit_after>//
//  RSImage-Extensions.swift
//  RSCore
//
//  Created by <NAME> on 4/11/19.
//  Copyright © 2019 Ranchero Software. All rights reserved.
//

import Foundation
import RSCore

extension RSImage {
	
	static let avatarSize = 48
	
	static func scaledForAvatar(_ data: Data, imageResultBlock: @escaping (RSImage?) -> Void) {
		DispatchQueue.global().async {
			let image = RSImage.scaledForAvatar(data)
			DispatchQueue.main.async {
				imageResultBlock(image)
			}
		}
	}
	
	static func scaledForAvatar(_ data: Data) -> RSImage? {
		
		let scaledMaxPixelSize = Int(ceil(CGFloat(RSImage.avatarSize) * RSScreen.mainScreenScale))
		guard let cgImage = RSImage.scaleImage(data, maxPixelSize: scaledMaxPixelSize) else {
			return nil
		}
		
		#if os(iOS)
		return RSImage(cgImage: cgImage)
		#else
		let size = NSSize(width: cgImage.width, height: cgImage.height)
		return RSImage(cgImage: cgImage, size: size)
		#endif
		
	}
	
}

{'fraction_non_alphanumeric': 0.10717896865520728, 'fraction_numerical': 0.012639029322548028, 'mean_word_length': 3.711904761904762, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3426147', 'n_tokens_mistral': 788, 'n_tokens_neox': 659, 'n_words': 169}