aguaviva / micro-jpeg-visualizer Goto Github PK
View Code? Open in Web Editor NEWin only 250 lines of code (no libs, just vanilla code)
License: MIT License
in only 250 lines of code (no libs, just vanilla code)
License: MIT License
Getting type mismatch error when trying to run it.
Traceback (most recent call last): File "micro-jpeg-visualizer.py", line 280, in <module> jpeg().decode(open('images/porsche.jpg', 'rb').read()) File "micro-jpeg-visualizer.py", line 267, in decode lenchunk = self.StartOfScan(data, lenchunk) File "micro-jpeg-visualizer.py", line 204, in StartOfScan matL, oldlumdccoeff = self.BuildMatrix(st,0, self.quant[self.quantMapping[0]], oldlumdccoeff) File "micro-jpeg-visualizer.py", line 173, in BuildMatrix code = self.tables[0+idx].GetCode(st) File "micro-jpeg-visualizer.py", line 156, in GetCode res = self.Find(st) File "micro-jpeg-visualizer.py", line 151, in Find r=r[st.GetBit()] File "micro-jpeg-visualizer.py", line 112, in GetBit return (b >> s) & 1 TypeError: unsupported operand type(s) for >>: 'str' and 'int'
Windows 10
Python 3.6
Running the script gives the following output:
Traceback (most recent call last):
File "micro-jpeg-visualizer.py", line 282, in <module>
j.decode(open('images/porsche.jpg', 'r').read())
File "micro-jpeg-visualizer.py", line 262, in decode
self.DefineQuantizationTables(chunk)
File "micro-jpeg-visualizer.py", line 214, in DefineQuantizationTables
self.quant[hdr & 0xf] = GetArray("B", data[1:1+64],64)
File "micro-jpeg-visualizer.py", line 36, in GetArray
return list(unpack(s,l[:length]))
struct.error: unpack requires a string argument of length 64
Python version using: Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500
32 bit (Intel)] on win
32
Original issue reported on code.google.com by [email protected]
on 5 Jan 2012 at 11:47
Is this repo accepting pull requests? I have expanded the code to work for various chroma subsampling also. Initially it was working for 1x1 only but now I can make it work for 1x2, 2x1 and 2x2 also.
When I change the porsche.jpg to my own picture, the error: IndexError: list index out of range, my picture is 512*512 and 55KB
Hi. Would you mind adding a license to your code? (something liberal, such as CC-0 or MIT license would be great)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.