Re: ** Windows 10 Examples **
Robby Bankston <[email protected]> Tue, 23 Mar 2021 12:07:20 -0500
| Newsgroups | gmane.comp.video.graphicsmagick.help |
|---|---|
| Message-ID | <CANSJg01sEjnRXpg3SBHeUV3iW+AnHky8_dUkMKPN0aS4BP3jUw@mail.gmail.com> |
--===============6830995547615379047== Content-Type: multipart/alternative; boundary="000000000000c2b68205be373756" --000000000000c2b68205be373756 Content-Type: text/plain; charset="UTF-8" Cheers RB On Tue, Mar 23, 2021 at 11:33 AM Bob Friesenhahn < [email protected]> wrote: > On Tue, 23 Mar 2021, Robby Bankston wrote: > > > > I was looking for some assistance with dynamic output filenames based on > > image properties under Windows 10 but haven't been having any luck. > > Ultimately I would like to use this for some batch or Powershell > scripting > > where the input name isn't known and is passed in. The few examples I've > > found have been bash style syntax which haven't worked and ImageMagick > > syntax didn't work either. I've dug through several tutorials, the docs, > > etc. > > but I'm either overlooking something or overcomplicating it > unnecessarily. > > I don't want to have to use 'identify' as a separate operation if > possible > > as that seems inefficient and my operations are limited to convert and > not > > mogrify. > > > > FAILED ATTEMPTS: > > gm.exe convert sample.png %t_%wx%h.jpg > > gm.exe convert sample.png '%t_%wx%h.jpg' > > gm.exe convert sample.png "%t_%wx%h.jpg" > > > > I know the vast majority of users will probably be in a *nix environment > so > > Windows users are the minority here but I would really appreciate some > > Windows examples added to the documentation to illustrate this. > > > > Any tips on how to handle this would be much appreciated. > > Thank you. > > While 'gm convert' does support -format as supported by identify, it > currently only expands it when the output is to the 'info' coder, and > it does not support dynamic output filename generation (which sounds > interesting but there may be some security concerns since the file > itself might produce some dangerous content). For example, by using > the -write option, it works to write some information into the file > 'meta.txt': > > gm convert logo: -format "%m %wx%h" -write info:meta.txt logo.png > type meta.txt > GIF 654x418 > > This provides the possibility for your script to use data written to a > separate file and rename the file written by GraphicsMagick to the > final desired file name based on the contents of that separate file > (which might even be the final desired file name). The input file is > then only read once, but the script needs to handle the final > re-naming itself. > > Bob > -- > Bob Friesenhahn > [email protected], http://www.simplesystems.org/users/bfriesen/ > GraphicsMagick Maintainer, http://www.GraphicsMagick.org/ > Public Key, http://www.simplesystems.org/users/bfriesen/public-key.txt > > > _______________________________________________ > Graphicsmagick-help mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/graphicsmagick-help > --000000000000c2b68205be373756 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Cheers<div><br></div><div>RB</div></div><br><div class=3D"= gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Tue, Mar 23, 2021 at = 11:33 AM Bob Friesenhahn <<a href=3D"mailto:[email protected]= ">[email protected]</a>> wrote:<br></div><blockquote class=3D= "gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(2= 04,204,204);padding-left:1ex">On Tue, 23 Mar 2021, Robby Bankston wrote:<br= > ><br> > I was looking for some assistance with dynamic output filenames based = on<br> > image properties under Windows 10 but haven't been having any luck= .<br> > Ultimately I would like to use this for some batch or Powershell scrip= ting<br> > where the input name isn't known and is passed in.=C2=A0 The few e= xamples I've<br> > found have been bash style syntax which haven't worked and ImageMa= gick<br> > syntax didn't work either.=C2=A0 I've dug through several tuto= rials, the docs,<br> > etc.<br> > but I'm either overlooking something or overcomplicating it unnece= ssarily.<br> > I don't want to have to use 'identify' as a separate opera= tion if possible<br> > as that seems inefficient and my operations are limited to convert and= not<br> > mogrify.<br> ><br> > FAILED ATTEMPTS:<br> > gm.exe convert sample.png %t_%wx%h.jpg<br> > gm.exe convert sample.png '%t_%wx%h.jpg'<br> > gm.exe convert sample.png "%t_%wx%h.jpg"<br> ><br> > I know the vast majority of users will probably be in a *nix environme= nt so<br> > Windows users are the minority here but I would really appreciate some= <br> > Windows examples added to the documentation to illustrate this.<br> ><br> > Any tips on how to handle this would be much appreciated.<br> > Thank you.<br> <br> While 'gm convert' does support -format as supported by identify, i= t <br> currently only expands it when the output is to the 'info' coder, a= nd <br> it does not support dynamic output filename generation (which sounds <br> interesting but there may be some security concerns since the file <br> itself might produce some dangerous content).=C2=A0 For example, by using <= br> the -write option, it works to write some information into the file <br> 'meta.txt':<br> <br> =C2=A0 =C2=A0gm convert logo: -format "%m %wx%h" -write info:meta= .txt logo.png<br> =C2=A0 =C2=A0type meta.txt<br> =C2=A0 =C2=A0GIF 654x418<br> <br> This provides the possibility for your script to use data written to a <br> separate file and rename the file written by GraphicsMagick to the <br> final desired file name based on the contents of that separate file <br> (which might even be the final desired file name).=C2=A0 The input file is = <br> then only read once, but the script needs to handle the final <br> re-naming itself.<br> <br> Bob<br> -- <br> Bob Friesenhahn<br> <a href=3D"mailto:[email protected]" target=3D"_blank">bfriesen@= simple.dallas.tx.us</a>, <a href=3D"http://www.simplesystems.org/users/bfri= esen/" rel=3D"noreferrer" target=3D"_blank">http://www.simplesystems.org/us= ers/bfriesen/</a><br> GraphicsMagick Maintainer,=C2=A0 =C2=A0 <a href=3D"http://www.GraphicsMagic= k.org/" rel=3D"noreferrer" target=3D"_blank">http://www.GraphicsMagick.org/= </a><br> Public Key,=C2=A0 =C2=A0 =C2=A0<a href=3D"http://www.simplesystems.org/user= s/bfriesen/public-key.txt" rel=3D"noreferrer" target=3D"_blank">http://www.= simplesystems.org/users/bfriesen/public-key.txt</a><br> <br> <br> _______________________________________________<br> Graphicsmagick-help mailing list<br> <a href=3D"mailto:[email protected]" target=3D"_bla= nk">[email protected]</a><br> <a href=3D"https://lists.sourceforge.net/lists/listinfo/graphicsmagick-help= " rel=3D"noreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/= listinfo/graphicsmagick-help</a><br> </blockquote></div> --000000000000c2b68205be373756-- --===============6830995547615379047== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============6830995547615379047== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Graphicsmagick-help mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/graphicsmagick-help --===============6830995547615379047==--