Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing compression level when saving image as jpg #822

Open
michael-prange opened this issue Oct 29, 2019 · 4 comments
Open

Changing compression level when saving image as jpg #822

michael-prange opened this issue Oct 29, 2019 · 4 comments
Labels
documentation Modifies the documentation. help wanted

Comments

@michael-prange
Copy link

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.

@johnnychen94
Copy link
Member

johnnychen94 commented Oct 29, 2019

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 JuliaIO/QuartzImageIO.jl#57 @rsrock

@timholy
Copy link
Member

timholy commented Oct 30, 2019

Want to submit a PR updating the README for https://github.com/JuliaIO/ImageMagick.jl, @michael-prange?

@michael-prange
Copy link
Author

michael-prange commented Oct 30, 2019 via email

@timholy
Copy link
Member

timholy commented Oct 30, 2019

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!

@johnnychen94 johnnychen94 added documentation Modifies the documentation. help wanted labels Jan 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Modifies the documentation. help wanted
Projects
None yet
Development

No branches or pull requests

3 participants