Skip to content

Get image extensions when not present in --img-name-col column #3

@thompsonmj

Description

@thompsonmj

The column used to write the filename may not have a file extension. A user might prefer to have images saved with extensions present in the filenames.

Another optional Boolean flag could be used to give the user the chance to specify something like:

  -e, --infer-extension  Infer the appropriate file extension if one is not present in the --img-name-col (default: False)

If this is switched on, some options mentioned in the discussion for #1 for doing this could be:

First, double check that there isn't a valid image extension in the --img-name-col to avoid writing a file with something like image.png.png (if there's an extension present and the user says -e, I can't imagine why they would have done so intentionally).

To detect an extension:

  • Use e.g. filetype to detect the appropriate extension based on the data itself and use that when writing the filename.
    or
  • Use the URL column to check for an extension and/or Content-Disposition header

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions