Skip to content

Increase image dimensions to u32? #13

@mstoeckl

Description

@mstoeckl

While reading over the code of this crate, I noticed that all working dimensions use u16. But I can use ImageMagick to create very wide g4 compressed tiff files (more than 2^16 pixels wide). Being able to decode and encode these (through the image-tiff crate) would require increasing the width and height parameters for all types in this crate to at least u32...

Reading over the spec for Group 4 decoding, I don't see any reference to image size limits.

Both TIFF and PDF specs, as far as I can tell, support 32 bit image dimensions. (TIFF 6.0 permits an ImageWidth with LONG field type, with value up to 2^32-1; and the PDF integer size limit is by convention 2^31-1 (per Annex C of the PDF 1.7 spec.)

Using usize or u64 instead would also be OK, but possibly overkill. (Many image formats and format libraries libraries already impose a <= u32::MAX dimension limit; there is BigTIFF which might be able to go larger, but I haven't confirmed this.)

This would unfortunately be an API breaking change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions