Images.jl
Images.jl copied to clipboard
Changing compression level when saving image as jpg
The documentation says that save() allows options to be set, but it doesn't say how to change the compression level when saving an image as jpg. The documentation "save(f, data...; options...) passes keyword arguments on to the saver" seems to suggest that options are accepted, but doesn't describe these options.
This is not documented clearly. FileIO.save
passes all keyword options to the real function, so you might need to find what's supported in image IO backends. Unfortunately, neither ImageMagick.jl
and QuartzImageIO.jl
document this.
If you're using ImageMagick.jl
as the backend, you can pass quality
as a keyword argument as the source code suggests.
julia> save("cameraman_100.jpg", img, quality=100)
julia> save("cameraman_1.jpg", img, quality=1)
jc@mathlf1:~/D/test $ du -sh *
4.0K cameraman_1.jpg
108K cameraman_100.jpg
As for QuartzImageIO.jl
, looks like there isn't such a keyword. Issue filed https://github.com/JuliaIO/QuartzImageIO.jl/issues/57 @rsrock
Want to submit a PR updating the README for https://github.com/JuliaIO/ImageMagick.jl, @michael-prange?
I don’t know how to do that. I just wanted to let the developers know that the documentation could use a bit of improvement. I love the package, but I had to read the code in order to find out about the quality option. Purpose of documentation is to avoid forcing everyone to read the code in order to use it most productively.
Sent from my iPad
On Oct 30, 2019, at 15:19, Tim Holy [email protected] wrote:
Want to submit a PR updating the README for https://github.com/JuliaIO/ImageMagick.jl, @michael-prange?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
https://www.freecodecamp.org/news/how-to-make-your-first-pull-request-on-github/
You can edit the README.md file in your web browser, no special skills required. Developers are people just like you!