-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
export qr_logo() #13
export qr_logo() #13
Conversation
Image looks very good and retrieves the requested URL, and the svg opens in MS Edge on my Windows computer. However, I could not programmatically save it as a png with: Error in plot.window(...) : need finite 'ylim' values |
Currently |
Good question.
The use case is to insert QR codes into PPTx files for interactive classrooms, or sometimes into Word files for posters. However, in response to your question, I just tested and found that I can drag and drop SVGs fine into these files. So no need for PNGs to avoid manual file conversions.
thanks much
bob
…________________________________
From: Thierry Onkelinx ***@***.***>
Sent: Wednesday, November 23, 2022 2:58 AM
To: ThierryO/qrcode ***@***.***>
Cc: Robert Badgett ***@***.***>; Mention ***@***.***>
Subject: Re: [ThierryO/qrcode] export qr_logo() (PR #13)
Currently qr_logo() only writes the svg file and returns invisible NULL. Hence plotting it's output doesn't work. What is your use case for png that doesn't work with svg?
—
Reply to this email directly, view it on GitHub<#13 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABHXP4ZZEBFUSRM4BYHSIDTWJXMCVANCNFSM6AAAAAASGPUIVQ>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@badgettrg can you try this version? |
When I try: When I try |
It looks like you reinstalled the hoxfix version (0.2.1) while the deploied version (0.2.0) was loaded. Can you try again in a clean session? It should load version 0.2.1. If not, close all R sessions, run |
Thanks, that allowed the code to run. Looks good, but as compared to the prior SVG function, both the current functions, qr_code, and generate_svg, are placing the logo off center. See outputs at HTTP://sumsearch.org/r/qr/ |
would it be easier to tell the user in the Help file the maximum or ideal logo size?
…________________________________
From: Thierry Onkelinx ***@***.***>
Sent: Friday, December 9, 2022 8:00 AM
To: ThierryO/qrcode ***@***.***>
Cc: Robert Badgett ***@***.***>; Mention ***@***.***>
Subject: Re: [ThierryO/qrcode] export qr_logo() (PR #13)
That's deliberate in the current implementation. The logo is scale so the error correction level is preserved. A logo with an more extreme width to height ratio could overlap with the finder and timing patterns. The logo is scaled and center to the area to the right and below the finder and timing patterns. Centering to the entire code might result in a smaller logo (to avoid the overlap).
[qr code pattern locations]<https://camo.githubusercontent.com/7e6328a123e33d9fbc1d30c430b8583d1c4bad0dad5a0bcef832b71646832631/68747470733a2f2f7777772e74686f6e6b792e636f6d2f71722d636f64652d7475746f7269616c2f66756e6374696f6e2d7061747465726e73322e706e67>
Maybe I could add an hjust and vjust argument to indicate the relative position of the logo center. E.g. hjust = 0.5 would place the center of the logo in the center of the qrcode. hjust = 0.75 would place the center at a quarter to the right side. But what if the logo is wider than half the qr code in such case? Clip the logo? Move the logo to the left until it fits? Keep the location of the logo center and shrink the logo until it fits?
—
Reply to this email directly, view it on GitHub<#13 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABHXP442PZ6LMMNG7PJSMCTWMM3OFANCNFSM6AAAAAASGPUIVQ>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@badgettrg and @markscherz, can you please test this version? I replaced Install it with |
The Rstudio help file displays "Internal Server Error" when I try to display help for add_logo so that I can see the parameters to pass.
But when I try
add_logo(code = code, logo = "logo.jpg")
I get:
Error: error level in `code` must be higher than `ecl` set in add_logo()
…________________________________
From: Thierry Onkelinx ***@***.***>
Sent: Friday, December 16, 2022 7:01 AM
To: ThierryO/qrcode ***@***.***>
Cc: Robert Badgett ***@***.***>; Mention ***@***.***>
Subject: Re: [ThierryO/qrcode] export qr_logo() (PR #13)
@badgettrg<https://github.com/badgettrg> and @markscherz<https://github.com/markscherz>, can you please test this version? I replaced qr_logo() with add_logo(). So you first generate a QR code and then add the logo. Hence it also works with qr_event() and qr_wifi(). The horizontal placement of the logo can be left, center or right. The vertical placement is either bottom, center or top.
Install it with ***@***.***") in a clean R session.
—
Reply to this email directly, view it on GitHub<#13 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABHXP42WDZKVIDMRBUO5AODWNRR33ANCNFSM6AAAAAASGPUIVQ>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
|
Great! The following works fine:
filename <- paste('qrcode-',domain,sep='')
if (logo == 1){filename <- paste(filename,'-logo',sep='')}
code <- qr_code(url, ecl = "H")
if (logo == 1){
filename = paste('qrcode-',domain,'-logo',sep='')
code <- add_logo(code = code, logo = "logo.jpg")
}
# SVG
generate_svg(
qrcode = code, filename = paste(filename,'.svg',sep=''), foreground = "#0022B4", show = FALSE
)
# PNG
png(file=paste(filename,'.png',sep=''))
plot(code)
dev.off()
Consider function qr_code accepting a foreground argument as generate_svg does.
…________________________________
From: Thierry Onkelinx ***@***.***>
Sent: Saturday, December 17, 2022 3:33 AM
To: ThierryO/qrcode ***@***.***>
Cc: Robert Badgett ***@***.***>; Mention ***@***.***>
Subject: Re: [ThierryO/qrcode] export qr_logo() (PR #13)
qr_code() and add_logo() use by default the lowest error level ("L"). Adding a logo on top of a QR code decreases error level. Therefore you must provide a QR code with a higher error levels as input to add_logo().
# largest difference in error level, hence largest logo
code <- qr_code("my text", ecl = "H")
add_logo(code, "logo.jpg")
# minimal difference, hence small logo
code <- qr_code("my text", ecl = "M")
add_logo(code, "logo.jpg")
code <- qr_code("my text", ecl = "H")
add_logo(code, "logo.jpg", ecl = "Q")
# error level in input too small
code <- qr_code("my text", ecl = "M")
add_logo(code, "logo.jpg", ecl = "H")
—
Reply to this email directly, view it on GitHub<#13 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABHXP452XJPQFN5WPDX2U3TWNWCILANCNFSM6AAAAAASGPUIVQ>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
qr_code working very well. Would like to handle a mailto link with subject line in order to solicit audience feedback at an oral presentation.
...picks up the email address, but does not pick up the subject line if you have time to add code to pick up subject and cc that would be great. No worries if no time. thanks |
The code below generates a qr code with the correct message. The problem is with the software scanning the code.
|
@badgettrg, can you give feedback on this branch? Install it with
remotes::install_github("ThierryO/qrcode@hotfix")