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

Support percent escape expanding #421

emcconville opened this issue Jul 9, 2019 · 1 comment

Support percent escape expanding #421

emcconville opened this issue Jul 9, 2019 · 1 comment


Copy link

@emcconville emcconville commented Jul 9, 2019

Note from email

And here are the list of % escapes that I asked about


Some of the more useful ones that I have used are:

%B -- filesize in bytes (same as %b, but always bytes with no character for B)
%x x resolution
%y y resolution
%O -- page (canvas) offset -- same as %X%Y
%P -- page (canvas) size -- same as %Wx%H
%@ -- trim crop box (computed)
%U units
%t base name
%e extension (suffix)
%[type] (computed)
%[colors] -- number unique colors
%[opaque] (computed)
%[printsize.x]  -- print size in x
%[printsize.y]  -- print size in y
@emcconville emcconville added this to the Wand 0.5.6 milestone Jul 9, 2019
Copy link
Owner Author

@emcconville emcconville commented Jul 9, 2019

This might be implemented by

from wand.image import Image
from wand.compat import text
with Image(filename='tests/assets/sasha.jpg') as img:
    f = ('%B %x %y %H %W %X %Y %O %P %@ %U %t %e \n'
         '%[channels] %[type] %[colors] %[colorspace] %[opaque] \n'
         '%[printsize.x] %[printsize.y] %[profiles]\n')
    img.options['format'] = f

Although some values will not be accurate. For example; image format (%m) will always be "INFO".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant