I am working on a web app that currently displays images in an archive by passing through output from convert directly to the browser. The PHP code that does this looks like this:
$cmd = "$convert '$imgpath' $options png:- ";
passthru( $cmd );
I have recently discovered that some of the source images are TIFFs that have two "pages", (they are scans of IDs -- one page is the front, the other is the back,) but only one page is being displayed. I would like to have convert take the second page and attach it on to one side of the first page such that both the front and back can be output as a single image.
I am aware that this can be done fairly easily using intermediate files, but I would really like to do it without using intermediate files for a variety of reasons. Multiple nested convert processes are fine as long as they don't generate temp files. What I mean by nested processes:
"convert arg1 -flag='$( another convert/something else call )' input_file png:-"
I would appreciate any ideas anyone has on how to do this.
I am using Linux, specifically Centos 5. I have these two versions of ImageMagick handy:
Version: ImageMagick 6.8.4-8 2013-04-10 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
Features: DPC
Delegates: bzlib freetype jng jpeg lcms png ps tiff x zlib
Version: ImageMagick 6.4.9-10 2009-10-07 Q16 OpenMP http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC
I can compile another version if necessary.
Tile n-pages of TIFF into 1 image
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Tile n-pages of TIFF into 1 image
"+append" should do it. If the input has one image, "+append" does nothing. If it has many images, they are placed side by side. As a command line:
Code: Select all
convert in.tif +append out.png
snibgo's IM pages: im.snibgo.com
Re: Tile n-pages of TIFF into 1 image
That did it! Thank you!
(I actually did RTFM quite a bit -- I even have a browser tab open from before I posted the question to the part of the manual that describes -append/+append. I have even read the part about this option at least a couple times. I have no idea why it didn't click in my mind that this would work. Perhaps I should have my head examined.)
(I actually did RTFM quite a bit -- I even have a browser tab open from before I posted the question to the part of the manual that describes -append/+append. I have even read the part about this option at least a couple times. I have no idea why it didn't click in my mind that this would work. Perhaps I should have my head examined.)
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Tile n-pages of TIFF into 1 image
I happens to me. I sometimes figure out a complex solution to a problem, completely overlooking a simple solution -- a solution that I always knew but had forgotten.
I sometimes think I have forgotten more than I ever knew.
I sometimes think I have forgotten more than I ever knew.
snibgo's IM pages: im.snibgo.com