Open enzyme69 opened 6 years ago
Making QR Code using Python of any version is actually easy enough using this PyQRCode module: https://pypi.org/project/PyQRCode/
You can output as SVG, PNG, etc.
You could in theory run this inside Blender and output into image. Make sure the module you install is using the same Python as the one inside Blender.
Using SWIFT PLAYGROUND on XCode (MacOS)
import Foundation
import UIKit
import PlaygroundSupport
//let data = "Hello World - Blender Sushi!".data(using: .utf8)!
//let data = "https://blendersushi.blogspot.com".data(using: .utf8)!
//let data = "https://maps.apple.com/?address=367 George Street, Sydney, Australia".data(using: .utf8)!
let data = "https://youtube.com/c/jimmygunawan".data(using: .utf8)!
//let data = "https://blendersushi.blogspot.com".data(using: .utf8)!
let filter = CIFilter(name: "CIQRCodeGenerator", parameters: ["inputMessage" : data, "inputCorrectionLevel":"L"])
//if let ciimage = filter?.outputImage { UIImage(ciImage: filter) }
let ciimage = filter!.outputImage!
let transform = CGAffineTransform(scaleX: 15.0, y: 15.0)
let image = ciimage.transformed(by: transform)
let img = UIImage(ciImage: image)
// saving out result
let path = playgroundSharedDataDirectory.appendingPathComponent("MyQR.PNG")
//let temp:CGImage = context.createCGImage(output, from: output.extent)!
//let image = UIImage(cgImage: temp)
//let blah = UIImage.pngData(img)
//try blah()?.write(to: path)
if let blah = img.pngData() {
try? blah.write(to: path)
}
// View LIVE
PlaygroundPage.current.liveView = UIImageView(image: img)