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

Closed
emcconville opened this issue Jul 9, 2019 · 1 comment
Closed

Support percent escape expanding #421

emcconville opened this issue Jul 9, 2019 · 1 comment
Labels
Milestone

Comments

@emcconville
Copy link
Owner

@emcconville emcconville commented Jul 9, 2019

Note from email

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

See https://imagemagick.org/script/escape.php

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
%H
%W
%X
%Y
%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)
%[channels]
%[type] (computed)
%[colors] -- number unique colors
%[colorspace]
%[opaque] (computed)
%[printsize.x]  -- print size in x
%[printsize.y]  -- print size in y
%[profiles]
%[profile:icc]
%[profile:icm]
@emcconville emcconville added this to the Wand 0.5.6 milestone Jul 9, 2019
@emcconville
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
    print(text(img.make_blob('info')))

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
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant