image-png
image-png copied to clipboard
Yet another PR like #122
Yet another PR like https://github.com/image-rs/image-png/pull/122 Add set_dpi
You don't need to open a new PR by the way, git
allows you to force push the branch and Github then updates the PR automatically. Not sure if this is possible through the web-interface.
Yeah, the commands would be something like:
$ git add foo.rs bar.rs
$ git commit --amend
$ git push --force-with-lease
Unfortunately, the unchecked cast from f64
to u32
in from_dpi
may not be as safe as one would like. Even if, as currently expected, it were to adopt saturating semantics the value could be unexpectedly lower than intended. It's also slightly confusing to have set_dpi
but no PixelDimensions::from_dpi
to parallel it.
The PR is already good without set_dpi
as it is pure utility. Can we address and design that in separate issue?
The conversion from inch to meter also follows from the definition of an inch as 25.4mm
. Hence, the more precise number to use is (1000.0/25.4)
but that shouldn't matter greatly for most calculations.
Superseded by #403