Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port image types detections from PIL to the imghdr module #65773

Closed
serhiy-storchaka opened this issue May 25, 2014 · 11 comments
Closed

Port image types detections from PIL to the imghdr module #65773

serhiy-storchaka opened this issue May 25, 2014 · 11 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

BPO 21574
Nosy @vstinner, @PCManticore, @serhiy-storchaka, @iritkatriel
Files
  • issue21574.patch: Port 10 new formats; some improvements
  • issue21574.zip: Test images
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2022-03-13.17:15:04.729>
    created_at = <Date 2014-05-25.09:37:01.012>
    labels = ['type-feature', 'library']
    title = 'Port image types detections from PIL to the imghdr module'
    updated_at = <Date 2022-03-13.17:15:04.728>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2022-03-13.17:15:04.728>
    actor = 'iritkatriel'
    assignee = 'none'
    closed = True
    closed_date = <Date 2022-03-13.17:15:04.729>
    closer = 'iritkatriel'
    components = ['Library (Lib)']
    creation = <Date 2014-05-25.09:37:01.012>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['36785', '36786']
    hgrepos = []
    issue_num = 21574
    keywords = ['patch']
    message_count = 11.0
    messages = ['219078', '219079', '224002', '224005', '228063', '228255', '237663', '237768', '238079', '348629', '415046']
    nosy_count = 7.0
    nosy_names = ['effbot', 'vstinner', 'pythonhacker', 'Claudiu.Popa', 'serhiy.storchaka', 'coldmind', 'iritkatriel']
    pr_nums = []
    priority = 'normal'
    resolution = 'wont fix'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue21574'
    versions = ['Python 3.5']

    @serhiy-storchaka
    Copy link
    Member Author

    It would be good to add support of all image types which are supported in PIL to the imghdr module.

    @serhiy-storchaka serhiy-storchaka added easy stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels May 25, 2014
    @PCManticore
    Copy link
    Mannequin

    PCManticore mannequin commented May 25, 2014

    Sounds good, I'll create a patch.

    @serhiy-storchaka
    Copy link
    Member Author

    Claudiu, are you working on this issue? If not, I'll start writing a patch.

    @PCManticore
    Copy link
    Mannequin

    PCManticore mannequin commented Jul 25, 2014

    No, I didn't start any work on this and right now, with EuroPython, I don't have that much time to start, so feel free to take it and write a patch.

    @coldmind
    Copy link
    Mannequin

    coldmind mannequin commented Oct 1, 2014

    @coldmind
    Copy link
    Mannequin

    coldmind mannequin commented Oct 2, 2014

    Hi! Here is first version of patch. What I've done:

    • Ported 10 new image formats from PIL (tests included)
    • Improved existing file detections like PIL does.
    • Add some byte manipulation routines

    One more thing - I removed ord() calls, because python3 expects unicode symbol,
    but bytes was provided, and I'm not sure is that right. Will these changes be included to python 3.5 only?

    Here are some other image formats in PIL, that I didn't port, because they are so excotic, that I didn't find
    even file examples. I can do this blindly, but I think without tests files this is useless.
    What community think about this?

    @PCManticore
    Copy link
    Mannequin

    PCManticore mannequin commented Mar 9, 2015

    In general, the patch looks good, I left a couple of comments on Rietvld. It should be applied to 3.5 only. Also, there are some image test files which aren't included in this patch, could you update it to include them? Thanks.

    @coldmind
    Copy link
    Mannequin

    coldmind mannequin commented Mar 10, 2015

    @Claudiu Popa, IIRC I did not add 1-2 test images because I not found how to make image or how to convert image to this format.
    So, if there will no chance to add them, should we remove these formats from the patch?

    @PCManticore
    Copy link
    Mannequin

    PCManticore mannequin commented Mar 14, 2015

    Well, we should have test files for each format imghdr supports. Doesn't PIL have test files for them?

    @vstinner
    Copy link
    Member

    This issue is 5 years old and has patches: it is no newcomer friendly, I remove the "easy" keyword.

    @vstinner vstinner removed the easy label Jul 29, 2019
    @iritkatriel
    Copy link
    Member

    imghdr is deprecated as per PEP-594, so there won't be further enhancements to it.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants