daniellerch / python-jpeg-toolbox Goto Github PK
View Code? Open in Web Editor NEWThe JPEG toolbox for Python
License: MIT License
The JPEG toolbox for Python
License: MIT License
Running a load then save of an image containing EXIF data appears to remove it. Can removal of EXIF either be made optional or updated to retain the EXIF information?
python3 setup.py install
/usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
/usr/lib/python3/dist-packages/setuptools/command/easy_install.py:146: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
jpeg_toolbox_extension.c: In function ‘read_file’:
jpeg_toolbox_extension.c:197:53: error: ‘struct jpeg_decompress_struct’ has no member named ‘block_size’
197 | result = dict_add_int(result, "block_size", cinfo.block_size);
| ^
jpeg_toolbox_extension.c:198:65: error: ‘struct jpeg_decompress_struct’ has no member named ‘min_DCT_h_scaled_size’; did you mean ‘min_DCT_scaled_size’?
198 | esult = dict_add_int(result, "min_DCT_h_scaled_size", cinfo.min_DCT_h_scaled_size);
| ^~~~~~~~~~~~~~~~~~~~~
| min_DCT_scaled_size
jpeg_toolbox_extension.c:199:65: error: ‘struct jpeg_decompress_struct’ has no member named ‘min_DCT_v_scaled_size’; did you mean ‘min_DCT_scaled_size’?
199 | esult = dict_add_int(result, "min_DCT_v_scaled_size", cinfo.min_DCT_v_scaled_size);
| ^~~~~~~~~~~~~~~~~~~~~
| min_DCT_scaled_size
jpeg_toolbox_extension.c:219:63: error: ‘jpeg_component_info’ has no member named ‘DCT_h_scaled_size’; did you mean ‘DCT_scaled_size’?
219 | comp = dict_add_int(comp, "DCT_h_scaled_size", compptr->DCT_h_scaled_size);
| ^~~~~~~~~~~~~~~~~
| DCT_scaled_size
jpeg_toolbox_extension.c:220:63: error: ‘jpeg_component_info’ has no member named ‘DCT_v_scaled_size’; did you mean ‘DCT_scaled_size’?
220 | comp = dict_add_int(comp, "DCT_v_scaled_size", compptr->DCT_v_scaled_size);
| ^~~~~~~~~~~~~~~~~
| DCT_scaled_size
jpeg_toolbox_extension.c: In function ‘write_file’:
jpeg_toolbox_extension.c:475:9: error: ‘struct jpeg_compress_struct’ has no member named ‘block_size’
475 | cinfo.block_size = dict_get_int(data, "block_size");
| ^
jpeg_toolbox_extension.c:476:9: error: ‘struct jpeg_compress_struct’ has no member named ‘min_DCT_h_scaled_size’
476 | cinfo.min_DCT_h_scaled_size = dict_get_int(data, "min_DCT_h_scaled_size");
| ^
jpeg_toolbox_extension.c:477:9: error: ‘struct jpeg_compress_struct’ has no member named ‘min_DCT_v_scaled_size’
477 | cinfo.min_DCT_v_scaled_size = dict_get_int(data, "min_DCT_v_scaled_size");
| ^
jpeg_toolbox_extension.c:500:16: error: ‘jpeg_component_info’ has no member named ‘DCT_h_scaled_size’; did you mean ‘DCT_scaled_size’?
500 | compptr->DCT_h_scaled_size = dict_get_int(item, "DCT_h_scaled_size");
| ^~~~~~~~~~~~~~~~~
| DCT_scaled_size
jpeg_toolbox_extension.c:501:16: error: ‘jpeg_component_info’ has no member named ‘DCT_v_scaled_size’; did you mean ‘DCT_scaled_size’?
501 | compptr->DCT_v_scaled_size = dict_get_int(item, "DCT_v_scaled_size");
| ^~~~~~~~~~~~~~~~~
| DCT_scaled_size
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
ERROR: Failed building wheel for jpeg-toolbox
Thanks for your work.
When I read an image with your toolbox, it has the following keys:
'image_width', 'image_height', 'image_color_space', 'image_components', 'jpeg_color_space', 'jpeg_components', 'progressive_mode', 'comp_info', 'quant_tables', 'ac_huff_tables', 'dc_huff_tables', 'coef_arrays'
I am not sure about the meaning of them. For example, what is the meaning of 'jpeg_color_space' = 3?
Can you provide their descriptions (or the reference of descriptions)?
the function "jpeg_toolbox.save()" does not work, I got a jpeg image with size of 0kb through the function everytime. How should I resolve this problem?
Hi, thanks for such a good work ! When I try to use the jpeg_toolbox.load() to read my jpg pics, it returns an empty dictionary, the original error is:
KeyError Traceback (most recent call last)
in
1 prefix = "../data/JPG"
2
----> 3 test = jpeg_toolbox.load(f"{prefix}/00899.jpg")
/data/anaconda3/lib/python3.8/site-packages/jpeg_toolbox.py in load(path, use_blocks)
23 r = jpeg.read_file(path.encode())
24
---> 25 r["quant_tables"] = np.array(r["quant_tables"])
26
27 for i in range(len(r["ac_huff_tables"])):
KeyError: 'quant_tables'
My python environment is 3.8 with Linux version 4.4.0-210-generic (buildd@lgw01-amd64-009) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12) ). Have no clue why this happened. Is there any thing I've missed ? and what's the exact environment this repository is compatible with? Thanks if you can help me out.
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.