S
S
Sergey2013-01-31 16:36:12
PowerShell
Sergey, 2013-01-31 16:36:12

Analogue of the % symbol from cmd to powershell

Good afternoon.
When passing a parameter to Imagemagic's external utility to convert a multi-page .pdf to .tiff, only the first page is converted. While looking for a solution, I came across this code:

convert original.tif output%d.tif

The % character doesn't work in PS the same way it does in CMD, and the output I get is 0.tif at the root with one first page.
$convert = 'C:\Program Files\ImageMagick-6.8.2-Q16\convert.exe'
$one = Get-Item '.\default.pdf'
$one
& $convert -density 200 -compress group4 $one 'c:\%d.tiff'


Tell me how to pass the parameter correctly so that the pages are processed correctly.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Sergey, 2013-02-01
@Jeisooo

Problem solved.
We need to edit the delegates.xml file in the Imagemagic directory. Alpha channel processing section.

<delegate decode="ps:alpha" stealth="True" command=""gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pnmraw" -dTextAlphaBits=%u -dGraphicsAlphaBits=%u "-r%s" %s "-sOutputFile=%s" "-f%s" "-f%s""/>

Source
The utility starts issuing all PDF pages separately, which can then be molded into one tiff with the mogrify command .

S
Sergey, 2013-01-31
@Jeisooo

It is this method of splitting a multi-page Pdf into pages that is indicated here. It seems like the convert.exe utility itself understands that it is necessary to extract all the pages in a cycle. Therefore, I sin on this symbol.

A
ApeCoder, 2013-03-27
@ApeCoder

In a powershell, the iscaping occurs with the symbol ` try `%

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question