Comments (3)
Yea thanks, got it working by saving it in a temp dir.
Note that your version may be quite slow, because writing as a JPEG involves unnecessary (re)compression, and may be lossy causing some images no longer to work.
What I was suggesting is modifying python-zxing itself to make this a built-in capability. π
You didn't specify in your original issue what image library you were using⦠so I assumed PIL Image
class, which is very commonly used in Python modules that manipulate images.. I went ahead and Just Did It, so now zxing.BarCodeReader
will accept the PIL Image class. See 81f55d3
If you want to extend this to work for the OpenCV format, it should be quite easy.
from python-zxing.
Is there any function to do this?
Not presently, but the module could easily be extended to do it using a NamedTemporaryFile.
from python-zxing.
Yea thanks, got it working by saving it in a temp dir.
img = cv2.imread('image.jpg')
imgOutput = #do something
with tempfile.TemporaryDirectory() as tmpdir:
cv2.imwrite(tmpdir+'/1.jpg', imgOutput)
files_in_dir = os.listdir(tmpdir)
## Image from temp dir
reader = zxing.BarCodeReader()
barcode = reader.decode(tmpdir+'/'+files_in_dir[0])
from python-zxing.
Related Issues (20)
- Cannot install from tarball HOT 1
- Command-line interface HOT 4
- data matrix generator HOT 1
- Fix TravisCI test failure for python 3.7, 3.8
- read multiple barcodes? HOT 3
- raw and parsed decode compatibility with ZXing HOT 5
- Use jpype for wrapper? HOT 2
- how to get rawByte from qr code? HOT 2
- utf-8 codec decoding error HOT 3
- How to get QR Code version, error correction level, and mask? HOT 4
- Can't find the code when there are other content in the image HOT 1
- Different results from online decoder HOT 2
- ZXing does not decode some QR images HOT 2
- UnboundLocalError: local variable 'bc' referenced before assignment HOT 4
- Issues in decoding PDF 417 format Barcodes HOT 2
- Can't install ZXing - FileNotFoundError "requirements.txt" HOT 13
- what's the difference between raw and parsed results? HOT 1
- Java binary specified does not exist HOT 2
- utf-8 encoding problem, ???????? instead of Thai letters HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-zxing.