- QR CODES
-
PRODUCT FREE
QR Code Generator
Create custom QR Codes for every use case
-
Dynamic QR Code Generator
-
Choosing the Best QR Code Generator
-
QR Code Tracking
-
QR Code API
-
How To Create a QR Code
-
GET STARTED
Select a template to continue
-
- DIGITAL BUSINESS CARDS
-
PRODUCT POPULAR
Digital Business Cards
Measure your networking with digital business cards
-
All About Digital Business Cards
-
Apple Wallet Business Cards
-
Physical Vs Digital Business Cards
-
Choosing The Best Digital Business Card Solution
-
How To Create a Digital Business Card
-
GET STARTED
Select a template to continue
-
- SOLUTIONS
- LEARN
-
Blog
Get the latest articles on QR Codes & Digital Business Cards.
QR Code Customization
Learn how to customize different elements of the QR Code
QR Code Buying Guide
Features to look out for, in your QR Code pricing plan
QR Code Analytics
QR Code analytics and use cases
Dynamic QR Code
What it is, how to create, and track
Digital Business Card Buying Guide
Feature based plans, for your business card
-
A powerful and easy solution for our business.
Uniqode’s solution has made our lives a lot easier.
Read all customer stories
-
- QR CODES QR CODES
PRODUCT FREE
QR Code Generator
Create custom QR Codes for every use case
Dynamic QR Code Generator
Choosing the Best QR Code Generator
QR Code Tracking
QR Code API
How To Create a QR Code
GET STARTED
Select a template to continue
- DIGITAL BUSINESS CARDS DIGITAL BUSINESS CARDS
PRODUCT POPULAR
Digital Business Cards
Measure your networking with digital business cards
All About Digital Business Cards
Apple Wallet Business Cards
Physical Vs Digital Business Cards
Choosing the Best Digital Business Card Solution
How To Create a Digital Business Card
GET STARTED
Select a template to continue
- SOLUTION SOLUTION
- LEARN LEARN
Blog
Get the latest articles on QR Codes & Digital Business Cards.
QR Code Customization
Learn how to customize different elements of the QR Code
QR Code Buying Guide
Features to look out for, in your QR Code pricing plan
QR Code Analytics
QR Code analytics and use cases
Dynamic QR Code
What it is, how to create, and track
Digital Business Card Buying Guide
Feature based plans, for your business card
A powerful and easy solution for our business.
Uniqode's solution has made our lives a lot easier.
MARCELO YANEZ
PRODUCT MANAGER,
NESTLE
Read all customer stories
-
PRICING
PRICING
-
DEMO
DEMO
×
Monika Adarsh
Last Updated: August 19, 2024
So you’ve clicked a picture of a QR Code you couldn’t scan earlier and stored it in your gallery? Or perhaps someone sent you a QR Code as an image?
Many people find themselves in this situation. The good news is that if you’ve clicked or received a picture of a QR Code and saved it in your gallery, you can scan it anytime at your convenience.
Whether you use an iPhone or an Android device, it’s possible to scan a QR Code from an image. Here’s how.
Table of contents
- How to scan a QR Code from a photo
- How to scan a QR Code from an image on iPhone
- How to scan a QR Code from a picture on Android
- Frequently asked questions
How to scan a QR Code from a photo: an easy guide
Getting users to leverage QR Codes on a mobile device is a simple 2-step process:
- Prompt users to take a screenshot of the website, signage, or the marketing collateral like interactive PDFs that the QR Code is on
- Scan the QR Code from the picture in the smartphone gallery (or Google Photos)
Both iOS and Android now have an easy way to read QR Codes from an image in the gallery. Given that you have an Android operating version 8 and above, and an iOS version 11 and above, your native camera acts as the QR Code scanner.
But if you have operating versions below 9 on Android and 11 on iOS, you require a third-party QR Code scanner app to read the QR Code. Check out our list on the 7 best QR Code scanner apps for your smartphone.
How to scan a QR Code from an image on iPhone?
Apple has made several advancements in the last couple of years to incorporate the growing need for QR Codes – live text and visual look-up that scans QR Codes in photos, which can identify and scan QR Codes in photos. Similar to how easily you can extract text from an image on Mac, this feature simplifies QR code scanning from images and photos.
Here’s how to do it –
- Open the picture/screenshot on your phone gallery.
- Click the live text detection app on the bottom right corner
- Click the QR Code and follow the prompt against it
If you have an iPad, or Mac, you can follow our guide on how to read QR Code on iOS.
How to scan QR Code from a picture on Android?
With Google’s image-recognition technology, scanning QR Codes from a photo is super simple. This capability is powered by Google Lens and baked into apps such as Google Assistant, Google Photos, or the Google App.
Here’s how to do it in 2 ways–
1. With Google Lens
- Launch the Google Lens application
- Choose the image from the gallery
- A popup link will appear once the app detects the QR Code
- Click the link to be redirected to the website or content
2. On phone gallery
- Open the picture on your phone gallery
- On the top right corner, tap the Google Lens icon
- A link will appear once it detects the QR Code
3. Using Bixby vision
- Open the Gallery app after taking a snapshot of your QR Code.
- Open the QR Code image
- Press and hold the Bixby Vision icon
Make sure Lens is selected before letting Bixby Vision scan the QR Code. Post scanning, a clickable pop-up page leads you to the destination content.
READ: More ways to scan a QR Code on Android.
Frequently asked questions
1. Do I need a third-party QR scanner app to scan a QR Code from the gallery?
The short answer is NO. Most of the latest Android and iOS support scanning the QR Code using Google Lens or the Live text option.
2. How to scan a QR Code from a screenshot?
You can easily scan a QR Code from a screenshot if you’re on iOS or Android. For iOS, open the picture in your gallery, tap live detection, and a popup will appear on the QR Code. For Android, open your gallery or Google Lens, choose the image with the QR Code, and a pop-up containing the link will appear once the app detects the QR Code.
3. Can I read a QR Code from an image?
Yes, you can read a QR Code from an image. Both iOS and Android devices allow you to scan a QR Code from an image in your gallery without any third-party application.
4. How to open QR Code from picture?
You can open QR Code from a picture in your gallery by using Google Lens on Android or live text detection or live text detection on iOS. Once it is scanned, a pop-up link will appear, directing you to the destination content.
If you are looking to create a QR Code for your next QR Code campaign, head to our free QR Code generator now!
Author Details
Monika Adarsh is the Director of Inbound Marketing at Uniqode where her primary job is to help users find answers to anything related to QR Codes. She works closely with customers to understand QR Code usage trends and build a framework for successful QR Code campaigns. She enjoys documenting her learnings about the QR Code market as posts and playbooks. She also anchors a podcastto uncover ways of using QR Codes in DTC/CPG brands. In her free time, she loves gardening and decorating spaces.
monika@mobstac.com
Related Posts
- How to generate circular QR Codes for your business
- Safe QR Code Generator: What Should You Look For?
- The Ultimate Guide on How to Leverage QR Codes to Sync Online and Offline Marketing
- How to Leverage an Email QR Code for a Remarkable Customer Experience
- How DTC Brands with Shopify Stores Can Ramp Up Coupon Marketing using QR Codes
Leave a Reply
14 day free trial of the QR platform
Products
-
QR CODES
-
QR Code Generator
-
Dynamic QR Code Generator
-
Bulk QR Code Generator
-
QR Code API
-
QR Code Tracking
-
DIGITAL BUSINESS CARD
-
Digital Business Cards
-
Digital Address Book
-
All Products & Features
-
Schedule a Demo
Use Cases
-
QR CODES
-
PDF Files
-
Website URLs
-
Location
-
App Download
-
Custom Landing Pages
-
Restaurant Menus
-
Custom Forms
-
All QR Code Use Cases
-
DIGITAL BUSINESS CARD
-
Email Signatures
-
Lead Management
-
Trade Shows
-
Field Sales
-
Law Firms
Learn
-
QR CODES
-
All About QR Codes
-
Dynamic vs. Static QR Codes
-
QR Code + Google Analytics
-
Guide: Custom QR Codes
-
DIGITAL BUSINESS CARD
-
Digital Business Cards 101
-
Active Directory Integration
-
Knowledge Base
Compare
-
QR CODES
-
Uniqode vs. QR Code Generator Pro
-
Paid vs. Free Solutions
-
Uniqode vs. Scanova
-
Uniqode vs. Flowcode
-
Uniqode vs. QR Tiger
-
Uniqode vs. Adobe
-
DIGITAL BUSINESS CARD
-
Uniqode vs. HiHello
-
Uniqode vs. Blinq
-
Uniqode vs. Popl
Company
Contact Us
- hello@uniqode.com
- +1 (646) 968 0378
Company
Contact Us
- hello@uniqode.com
- +1 (646) 968 0378
-
Products
-
Use Cases
-
QR CODES
-
PDF Files
-
Website URLs
-
Location
-
App Download
-
Custom Landing Pages
-
Restaurant Menus
-
Custom Forms
-
All QR Code Use Cases
-
DIGITAL BUSINESS CARD
-
Email Signatures
-
Lead Management
-
Trade Shows
-
Field Sales
-
Law Firms
-
-
Learn
-
Compare
-
Company
-
Contact Us
- hello@uniqode.com
- +1 (646) 968 0378
-
© 2024 Uniqode Phygital, Inc. All rights reserved.
© QR Code is a registered trademark of Denso Wave Incorporated.
${range.value} ${countText}
`; // count.style.left = `calc(${newValue}% + (${newPosition}px))`; document.documentElement.style.setProperty("--range-progress", `calc(${newValue}% + (${newPosition}px))`); const saving_amount_element = document.getElementById("saving_amount"); saving_amount_element.textContent = '$'+ (parseInt(range.value) * 194).toLocaleString(); const tree_count_element = document.getElementById("tree_count"); const main_val = (range.value - 50); tree_count_element.textContent = parseInt(( main_val / 35 )) + parseInt(1); if(range.value <= 50){ document.getElementById("recommended-plan-text").textContent = "Lite"; }else if(range.value >= 85 && range.value <= 225){ document.getElementById("recommended-plan-text").textContent = "Pro"; }else if(range.value >= 260 && range.value <= 470){ document.getElementById("recommended-plan-text").textContent = "Plus"; }else{ document.getElementById("recommended-plan-text").textContent = "Enterprise"; }};document.addEventListener("DOMContentLoaded", setValue);range.addEventListener('input', setValue);}function navheaderTemplateRedirectToSignup(campaign = 'template', header = "", product, device = "desktop") { const utm_source = "Website"; let medium; let codeData = null; let layout = ''; if (product === 'QR') { const qrCodeDataArray = { 1:'ewogICJxcl9jYW1wYWlnbl90eXBlIjogImdlbmVyYWwiLAogICJkZXNpZ24iOiB7CiAgICAiY29sb3IiOiAiIzAwMDAwMCIsCiAgICAiY29sb3JEYXJrIjogIiMwMDAwMDAiLAogICAgImNvbG9yTGlnaHQiOiAiIzAwMDAwMCIsCiAgICAiZ3JhZGllbnRUeXBlIjogIm5vbmUiLAogICAgImJhY2tncm91bmRJbWFnZSI6ICIiLAogICAgImJhY2tncm91bmRDb2xvciI6ICIjRkZGRkZGIiwKICAgICJsb2dvSW1hZ2UiOiAiIiwKICAgICJmcmFtZVN0eWxlIjogIm5vbmUiLAogICAgImZyYW1lQ29sb3IiOiAiI0QwMkU2MCIsCiAgICAiZnJhbWVUZXh0IjogIiIsCiAgICAiZnJhbWVUZXh0Q29sb3IiOiAiI0ZGRkZGRiIsCiAgICAiZGF0YVBhdHRlcm4iOiAiY2lyY2xlIiwKICAgICJleWVCYWxsU2hhcGUiOiAicm91bmRlZCIsCiAgICAiZXllRnJhbWVTaGFwZSI6ICJsZWZ0LWxlYWYiLAogICAgImV5ZUJhbGxDb2xvciI6ICIjMDAwMDAwIiwKICAgICJleWVGcmFtZUNvbG9yIjogIiNGRjk0MjQiLAogICAgImxvZ29CYWNrZ3JvdW5kIjogdHJ1ZSwKICAgICJtYXJnaW4iOiA4MCwKICAgICJkb3RTY2FsZSI6IDEsCiAgICAicmVjdGFuZ3VsYXIiOiB0cnVlLAogICAgImxvZ29XaWR0aCI6IDAsCiAgICAibG9nb0hlaWdodCI6IDAsCiAgICAibG9nb01hcmdpbiI6IDEwLAogICAgImxvZ29TY2FsZSI6IDAuMiwKICAgICJpc1ZDYXJkIjogdHJ1ZQogIH0KfQ==', 2:'ewogICJxcl9jYW1wYWlnbl90eXBlIjogImdlbmVyYWwiLAogICJkZXNpZ24iOiB7CiAgICAiY29sb3IiOiAiIzAwMDAwMCIsCiAgICAiY29sb3JEYXJrIjogIiNBRjlENUUiLAogICAgImNvbG9yTGlnaHQiOiAiIzAwMDAwMCIsCiAgICAiZ3JhZGllbnRUeXBlIjogInJhZGlhbCIsCiAgICAiYmFja2dyb3VuZEltYWdlIjogIiIsCiAgICAiYmFja2dyb3VuZENvbG9yIjogIiMwMDAwMDAiLAogICAgImxvZ29JbWFnZSI6ICIiLAogICAgImZyYW1lU3R5bGUiOiAibm9uZSIsCiAgICAiZnJhbWVDb2xvciI6ICIjRDAyRTYwIiwKICAgICJmcmFtZVRleHQiOiAiIiwKICAgICJmcmFtZVRleHRDb2xvciI6ICIjRkZGRkZGIiwKICAgICJkYXRhUGF0dGVybiI6ICJraXRlIiwKICAgICJleWVCYWxsU2hhcGUiOiAic3F1YXJlIiwKICAgICJleWVGcmFtZVNoYXBlIjogInNxdWFyZSIsCiAgICAiZXllQmFsbENvbG9yIjogIiNBRjlENUUiLAogICAgImV5ZUZyYW1lQ29sb3IiOiAiI0ZGRkZGRiIsCiAgICAibG9nb0JhY2tncm91bmQiOiB0cnVlLAogICAgIm1hcmdpbiI6IDgwLAogICAgImRvdFNjYWxlIjogMSwKICAgICJyZWN0YW5ndWxhciI6IHRydWUsCiAgICAibG9nb1dpZHRoIjogMCwKICAgICJsb2dvSGVpZ2h0IjogMCwKICAgICJsb2dvTWFyZ2luIjogMTAsCiAgICAibG9nb1NjYWxlIjogMC4yLAogICAgImlzVkNhcmQiOiB0cnVlCiAgfQp9', 3:'ewogICJxcl9jYW1wYWlnbl90eXBlIjogImdlbmVyYWwiLAogICJkZXNpZ24iOiB7CiAgICAiY29sb3IiOiAiIzAwMDAwMCIsCiAgICAiY29sb3JEYXJrIjogIiMyRTFEODkiLAogICAgImNvbG9yTGlnaHQiOiAiIzJFMUQ4OSIsCiAgICAiZ3JhZGllbnRUeXBlIjogIm5vbmUiLAogICAgImJhY2tncm91bmRJbWFnZSI6ICIiLAogICAgImJhY2tncm91bmRDb2xvciI6ICIjQzBGRjQwIiwKICAgICJsb2dvSW1hZ2UiOiAiIiwKICAgICJmcmFtZVN0eWxlIjogIm5vbmUiLAogICAgImZyYW1lQ29sb3IiOiAiI0QwMkU2MCIsCiAgICAiZnJhbWVUZXh0IjogIiIsCiAgICAiZnJhbWVUZXh0Q29sb3IiOiAiI0ZGRkZGRiIsCiAgICAiZGF0YVBhdHRlcm4iOiAiY2lyY2xlIiwKICAgICJleWVCYWxsU2hhcGUiOiAiY2lyY2xlIiwKICAgICJleWVGcmFtZVNoYXBlIjogImNpcmNsZSIsCiAgICAiZXllQmFsbENvbG9yIjogIiMyRTFEODkiLAogICAgImV5ZUZyYW1lQ29sb3IiOiAiIzJFMUQ4OSIsCiAgICAibG9nb0JhY2tncm91bmQiOiB0cnVlLAogICAgIm1hcmdpbiI6IDgwLAogICAgImRvdFNjYWxlIjogMSwKICAgICJyZWN0YW5ndWxhciI6IHRydWUsCiAgICAibG9nb1dpZHRoIjogMCwKICAgICJsb2dvSGVpZ2h0IjogMCwKICAgICJsb2dvTWFyZ2luIjogMTAsCiAgICAibG9nb1NjYWxlIjogMC4yLAogICAgImlzVkNhcmQiOiB0cnVlCiAgfQp9' }; const qrTemplates = getTemplates("qr-template", "qr-template-mob", device); const qrTemplateSelected = getSelectedTemplate(qrTemplates,product); codeData = qrCodeDataArray[qrTemplateSelected]; medium = 'topnav' + qrTemplateSelected; } else if (product === 'DBC') { const dbcCodeDataArray = { 1:'ewogICJxcl9jYW1wYWlnbl90eXBlIjogImdlbmVyYWwiLAogICJkZXNpZ24iOiB7CiAgICAiY29sb3IiOiAiIzAwMDAwMCIsCiAgICAiY29sb3JEYXJrIjogIiMwMDAwMDAiLAogICAgImNvbG9yTG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iY2lyY2xlIiwKICAgICJleWVCYWxsU2hhcGUiOiAiY2lyY2xlIiwKICAgICJleWVGcmFtZVNoYXBlIjogImNpcmNsZSIsCiAgICAiZXllQmFsbENvbG9yIjogIiMyRTFEODkiLAogICAgImV5ZUZyYW1lQ29sb3IiOiAiIzJFMUQ4OSIsCiAgICAibG9nb0JhY2tncm91bmQiOiB0cnVlLAogICAgIm1hcmdpbiI6IDgwLAogICAgImRvdFNjYWxlIjogMSwKICAgICJyZWN0YW5ndWxhciI6IHRydWUsCiAgICAibG9nb1dpZHRoIjogMCwKICAgICJsb2dvSGVpZ2h0IjogMCwKICAgICJsb2dvTWFyZ2luIjogMTAsCiAgICAibG9nb1NjYWxlIjogMC4yLAogICAgImlzVkNhcmQiOiB0cnVlCiAgfQp9' }; const dbcTemplates = getTemplates("dbc-template", "dbc-template-mob", device); const dbcTemplateSelected = getSelectedTemplate(dbcTemplates,product); codeData = dbcCodeDataArray[dbcTemplateSelected-DASHBOARD_LAYOUT_NO]; medium = 'topnav' + dbcTemplateSelected; layout = `&layout=${dbcTemplateSelected}`; } if (codeData) { const url = generateSignupURL(header, product, utm_source, codeData, medium, campaign, layout); window.location.href = url; }}function getTemplates(desktopName, mobileName, device) { const templates = device === 'desktop' ? document.getElementsByName(desktopName) : document.getElementsByName(mobileName); return templates;}function getSelectedTemplate(templates,product) { for (let i = 0; i < templates.length; i++) { if (templates[i].checked) { return i + (product == 'DBC' ? 4 : 1); } } return 1;}function generateSignupURL(header, product, utm_source, codeData, medium, campaign, layout) { return `https://www.uniqode.com/store/starter-signup?trial_source=${header}&product_selected=${product}&utm-source=${utm_source}&qr_code_data=${codeData}&medium=${medium}&campaign=${campaign}${layout}`;}function closeAllTab() { const elementsToRemoveClass = [ 'product-drop', 'dbcProduct-drop', 'solution-drop', 'learn-drop' ]; elementsToRemoveClass.forEach(elementId => { const element = document.getElementById(elementId); if (element) { element.classList.remove('open'); } }); const dropdownLinks = document.querySelectorAll('[data-productid]'); dropdownLinks.forEach(currentDropdown => { currentDropdown.classList.remove('open'); currentDropdown.style.backgroundColor = ''; currentDropdown.style.color = ''; });}let isAnimate = true;let isStartingLoad = true;let isSameNavItem = '';const ANIMATION_DURATION = '0.4s';const ANIMATION_NONE = '0s';const ANIMATION_CLASS = 'slideAndFade';const ACTIVE_CLASS = 'list-active';const OPEN_CLASS = 'open';function openNavTab(element) { closeAllTab(); const expanedNavItem = document.getElementById(element.getAttribute('data-productid')); element.classList.add('open'); expanedNavItem.classList.add('open'); if (isAnimate) { expanedNavItem.style.animation = `${ANIMATION_CLASS} ${ANIMATION_DURATION} forwards`; } else { expanedNavItem.style.animation = `${ANIMATION_CLASS} ${ANIMATION_NONE} forwards`; }}const dropdown = document.querySelectorAll('[data-productid]');dropdown.forEach((currentNavItem) => { currentNavItem.addEventListener("click", function (event) { if(isStartingLoad) { isStartingLoad = !isStartingLoad; } else { isAnimate = false; } const navItemId = currentNavItem.getAttribute('data-productid'); if (isSameNavItem !== navItemId) { if (isSameNavItem !== '') { closeAllTab(); } openNavTab(currentNavItem); } else { // If the same nav item is clicked again, toggle the "open" class const expanedNavItem = document.getElementById(navItemId); expanedNavItem.classList.toggle('open'); currentNavItem.classList.toggle('open'); if (isAnimate) { expanedNavItem.style.animation = expanedNavItem.classList.contains('open') ? `${ANIMATION_CLASS} ${ANIMATION_DURATION} forwards` : `${ANIMATION_CLASS} ${ANIMATION_NONE} forwards`; } else { expanedNavItem.style.animation = expanedNavItem.classList.contains('open') ? `${ANIMATION_CLASS} ${ANIMATION_NONE} forwards` : `${ANIMATION_CLASS} ${ANIMATION_DURATION} forwards`; } } isSameNavItem = navItemId; });});const dropdownContent = document.querySelectorAll('.dropdown-content');dropdownContent.forEach((currentDropdownContent) => { currentDropdownContent.addEventListener("mouseleave", handleMouseLeave);});function handleMouseLeave(event) { const { clientY } = event; const { bottom } = this.getBoundingClientRect(); if (clientY > bottom) { resetFlagsAndNavigation(); closeAllTab(); }}function resetFlagsAndNavigation() { isAnimate = true; isStartingLoad = true; isSameNavItem = '';}const nonDropdownItems = document.querySelectorAll('.list-non-dropdown');nonDropdownItems.forEach(currentNavItem => { currentNavItem.addEventListener("click", handleNonDropdownMouseOver);});function handleNonDropdownMouseOver() { isSameNavItem = ''; isStartingLoad = true; isAnimate = true; closeAllTab();}const dropdownViewport = document.querySelectorAll('.dropdown-content');dropdownViewport.forEach(currentDropdown => { currentDropdown.addEventListener('click', () => { if (currentDropdown.classList.contains('open')) { const currentExpandedLink = document.querySelector(`[data-productid="${currentDropdown.id}"]`); currentExpandedLink.style.backgroundColor = '#2595FF'; currentExpandedLink.style.color = 'white'; } });});if(576 <= window.innerWidth && window.innerWidth <=768) { const navDropDown = document.querySelectorAll('.dropdown-link'); for(let nav = 0;nav