Skip to content

Commit

Permalink
FIX: DNG DefaultCropSize to Rect calculation
Browse files Browse the repository at this point in the history
Because of this bug, converting a DNG file into a new DNG file
shrinks the crop size.
  • Loading branch information
cytrinox committed Mar 30, 2024
1 parent 11450c6 commit 427bfe3
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ data:
x: 8
y: 5
d:
w: 3832
h: 2155
w: 3840
h: 2160
activeArea:
p:
x: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ data:
x: 8
y: 5
d:
w: 3832
h: 2155
w: 3840
h: 2160
activeArea:
p:
x: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ data:
x: 8
y: 5
d:
w: 3832
h: 2155
w: 3840
h: 2160
activeArea:
p:
x: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ data:
x: 8
y: 5
d:
w: 1912
h: 1075
w: 1920
h: 1080
activeArea:
p:
x: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ data:
x: 8
y: 5
d:
w: 1912
h: 1075
w: 1920
h: 1080
activeArea:
p:
x: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ data:
x: 8
y: 5
d:
w: 1912
h: 1075
w: 1920
h: 1080
activeArea:
p:
x: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ data:
x: 32
y: 21
d:
w: 5968
h: 3979
w: 6000
h: 4000
activeArea:
p:
x: 0
Expand Down
5 changes: 3 additions & 2 deletions rawler/src/decoders/dng.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use crate::formats::tiff::Rational;
use crate::formats::tiff::Value;
use crate::imgop::xyz::FlatColorMatrix;
use crate::imgop::xyz::Illuminant;
use crate::imgop::Dim2;
use crate::imgop::Point;
use crate::imgop::Rect;
use crate::packed::*;
Expand Down Expand Up @@ -387,8 +388,8 @@ impl<'a> DngDecoder<'a> {
if let Some(crops) = raw.get_entry(DngTag::DefaultCropOrigin) {
let p = Point::new(crops.force_usize(0), crops.force_usize(1));
if let Some(size) = raw.get_entry(DngTag::DefaultCropSize) {
let s = Point::new(size.force_usize(0), size.force_usize(1));
return Some(Rect::new_with_points(p, s));
let d = Dim2::new(size.force_usize(0), size.force_usize(1));
return Some(Rect::new(p, d));
}
}
None
Expand Down

0 comments on commit 427bfe3

Please sign in to comment.