Page 1 of 1
Convert multi-page tiff from STDIN pipe
Posted: 2010-07-13T00:43:01-07:00
by .thud
Goal: Convert a multi-page tiff file into several png files when reading from STDIN.
Problem: When you have a file as input you can index frames e.g. using
convert "infile.tif
" b%03d.tif (http://www.imagemagick.org/Usage/formats/#tiff)
but this syntax cannot be used when piping input from STDIN.
For example, I tried "tiff[0]:-" as STDIN placeholder and "png:-" as STDOUT placeholder
which does not work. I did not find documentation on the placeholder syntax.
I do not want to save it on disk if this can be avoided!
Big thanks for your ideas!
Re: Convert multi-page tiff from STDIN pipe
Posted: 2010-07-13T08:45:32-07:00
by Drarakel
If you want to convert a multipage TIF from stdin into separate PNGs, you should be able to use something like that:
... convert - page%3d.png (for three digits)
If you want to pick only a certain page (or a range of pages), use something like this:
... convert -[0] page0.png
Some documentation:
http://www.imagemagick.org/Usage/files/#read_mods
http://www.imagemagick.org/Usage/files/#adjoin
Works for me at least (IM v6.6.3-0, Windows).
But while testing it, I noticed some irregularities. Seems that if one writes to stdout, the pixel cache files for some formats doesn't get deleted. Example (look in your temporary directory):
convert rose: TIFF:- | identify -
And, on my system, writing a image sequence to stdout can result in a crash:
convert rose: logo: BMP:- | identify -
Can someone else reproduce it?
Re: Convert multi-page tiff from STDIN pipe
Posted: 2010-07-13T10:08:11-07:00
by snibgo
Code: Select all
But while testing it, I noticed some irregularities. Seems that if one writes to stdout, the pixel cache files for some formats doesn't get deleted. Example (look in your temporary directory):
convert rose: TIFF:- | identify -
And, on my system, writing a image sequence to stdout can result in a crash:
convert rose: logo: BMP:- | identify -
Can someone else reproduce it?
Confirmed on Windows 7, IM 6.6.0-8 and 6.6.3-0.
Re: Convert multi-page tiff from STDIN pipe
Posted: 2010-07-13T11:35:16-07:00
by Drarakel
snibgo wrote:Confirmed on Windows 7, IM 6.6.0-8 and 6.6.3-0.
Thanks! These issues are probably not very important, but I created a
thread in the bugs forum.
Re: Convert multi-page tiff from STDIN pipe
Posted: 2010-07-13T16:50:32-07:00
by anthony
Drarakel wrote:But while testing it, I noticed some irregularities. Seems that if one writes to stdout, the pixel cache files for some formats doesn't get deleted. Example (look in your temporary directory):
convert rose: TIFF:- | identify -
And, on my system, writing a image sequence to stdout can result in a crash:
convert rose: logo: BMP:- | identify -
Can someone else reproduce it?
such a thing should be reported as a bug. We have had reports of tmp junk being left behind, but nothing about the commands which could caused the junk tmp files.
No junk /tmp files were left, and I get a good identify.
Code: Select all
convert rose: logo: BMP:- | identify -
Produces an error (convert: unable to write blob `-') so it may be the BMP coder can not handle stdout. It does leave 2 /tmp junk files.
Re: Convert multi-page tiff from STDIN pipe
Posted: 2010-07-14T10:47:08-07:00
by Drarakel
Thanks for testing. The replies are in the
thread in the bugs forum.