ghallak / jpeg-python Goto Github PK
View Code? Open in Web Editor NEWJPEG encoder/decoder written in Python
JPEG encoder/decoder written in Python
I tried
python encoder.py test.bmp output.txt
then get a 0-1 string content text document
python decoder.py output.txt
then windwos Photos App shows the 90 degrees rotated image.
is this correct?
i want to know
"parser.add_argument("output", help="path to the output image")", the output parameter‘s format is what?
i set :
input
./原始图像.bmp
output
./yasuo.jpg"
it sent:
usage: encoder.py [-h] input output
encoder.py: error: unrecognized arguments: output ./yasuo.jpg
Hi @ghallak , could you add an open source license to your code? for example the MIT license? I would like to re-use the code, modify it and make it open.
Thanks
Hi Gaith,
I noticed in your jpeg repo that dct transformation code is not right,
dct_matrix = fftpack.dct(block, norm='ortho')
since the fftpack.dct() function is only 1D DCT instead of 2D DCT as in JPEG compression.
It should be implemented as follows,
def dct2(image):
return fftpack.dct(fftpack.dct(image.T, norm='ortho').T, norm='ortho')
dct_matrix = dct2(block)
And similar for inverse dct transform..
I have some problems with read_huffman_code function in decoder. When the chars end, the function endlessly adds to the prefix '' and the cycle does not end. Can you please explain me what the problem is?
Great code for demonstrating the inner workings of JPEG using an easily interpreted language.
Minor critique - you may wish to include DPCM in your encoding of the DC components. Given how you're already segmenting DC and AC components, the modifications required to the encoder and decoder should be minimal.
Hey! After encoding, i have broken jpeg. Its HEX contains only 0x31 and 0x30. After decoding i have a very bad image. Help)
I think u need to downsample your Cb abd Cr chanell after you convert the image Y CbCr
I have a png image with 423300 bytes.
After I ran
python ./encoder.py input.png output.jpg
The output.jpg file had 1565098 bytes.
When I try to run this: python encoder.py -h ./image.bmp ./output.jpg
it gives me this error:
File "encoder.py", line 60 os.path.dirname(filepath))) from e ^ SyntaxError: invalid syntax
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.