image-png icon indicating copy to clipboard operation
image-png copied to clipboard

Yet another PR like #122

Open 3442853561 opened this issue 5 years ago • 4 comments

Yet another PR like https://github.com/image-rs/image-png/pull/122 Add set_dpi

3442853561 avatar Apr 30 '19 08:04 3442853561

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.

HeroicKatora avatar Apr 30 '19 14:04 HeroicKatora

Yeah, the commands would be something like:

$ git add foo.rs bar.rs
$ git commit --amend
$ git push --force-with-lease

fintelia avatar Apr 30 '19 14:04 fintelia

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?

HeroicKatora avatar Apr 30 '19 16:04 HeroicKatora

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.

HeroicKatora avatar Apr 30 '19 18:04 HeroicKatora

Superseded by #403

fintelia avatar Jul 23 '23 19:07 fintelia