Skip to content

Commit

Permalink
[toimage] redefine default output extensions on unwrap
Browse files Browse the repository at this point in the history
  • Loading branch information
Enet4 committed Sep 25, 2023
1 parent e5d5bbf commit 5e72506
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions toimage/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ fn run(args: App) -> Result<(), Error> {
// try to identify a better extension for this file
// based on transfer syntax
match obj.meta().transfer_syntax() {
uids::JPEG_BASELINE8_BIT | uids::JPEG_LOSSLESS | uids::JPEG_LOSSLESS_SV1 => {
uids::JPEG_BASELINE8_BIT
| uids::JPEG_EXTENDED12_BIT
| uids::JPEG_LOSSLESS
| uids::JPEG_LOSSLESS_SV1 => {
path.set_extension("jpg");
}
uids::JPEG_EXTENDED12_BIT => {
path.set_extension("jpe");
}
uids::JPEG2000
| uids::JPEG2000MC
| uids::JPEG2000MC_LOSSLESS
Expand Down Expand Up @@ -240,7 +240,8 @@ fn run(args: App) -> Result<(), Error> {

let rows = get_int_property(tags::ROWS, "Rows")?;
let columns = get_int_property(tags::COLUMNS, "Columns")?;
let samples_per_pixel = get_int_property(tags::SAMPLES_PER_PIXEL, "Samples Per Pixel")?;
let samples_per_pixel =
get_int_property(tags::SAMPLES_PER_PIXEL, "Samples Per Pixel")?;
let bits_allocated = get_int_property(tags::BITS_ALLOCATED, "Bits Allocated")?;
let frame_size = rows * columns * samples_per_pixel * ((bits_allocated + 7) / 8);

Expand Down

0 comments on commit 5e72506

Please sign in to comment.