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

Saving an image with a colon in its name results in an incorrect file name #657

Closed
taranlu-houzz opened this issue May 10, 2024 · 1 comment

Comments

@taranlu-houzz
Copy link

  • Create a wand.image.Image
  • Try to save the image with a filename that includes a colon:
    img.save(filename="beep:boop.png")
  • Resulting file is called boop.png

OS: macOS 13.6.6 (22G630)
CPU: M1Pro

@emcconville
Copy link
Owner

The colon character is restricted with ImageMagick as it's part of the coder protocol. For example...

# Force PNG 48-bit RGB
img.save(filename='png48:boop.png')

Possible Solutions

  • You can try to double escape it.
    img.save(filename="beep\\:boop.png")
  • Use a file object.
    with open('beep:boop.png', 'wb')  as fh:
        img.save(file=fh)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants