assembling images

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
svadagio
Posts: 7
Joined: 2011-12-11T12:54:36-07:00
Authentication code: 8675308

assembling images

Post by svadagio »

Hi
I am putting together images that are made up of many small images. I am using the -append command. It works fine to put the images together but if the first image is black and white it converts the whole thing to black and white. They are color with a large black and white border. I have not been able to find a way to fix this. Can someone help.
Thanks
Bob
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: assembling images

Post by fmw42 »

Have you tried montage? see http://www.imagemagick.org/Usage/montage/

Or with -append have you tried adding -type truecolor just before the output?

What version of IM are you using and what platform?

What output format for your result?


This works just fine for me:


convert \( rose: -colorspace gray \) rose: rose: rose: +append rose_append.png


The first image is gray and the rest are color. I am using IM 6.7.4.0 Q16 Mac OSX Snow Leopard
svadagio
Posts: 7
Joined: 2011-12-11T12:54:36-07:00
Authentication code: 8675308

Re: assembling images

Post by svadagio »

Hi
I tried the -type truecolor, no joy.
I looked a -merge but though it would not join the tiles right. I need for it to put them together edge to edge. These tiles are intended to do this. They are each the same size exactly.

These images are comprised of sometimes over a 100 tiles. I first convert them to tif(they are in a propriatary format.).
Then assemble the colums and then the rows. Finaly I convert to gif then png with -colors 127. This is because the next program requires a certian type of colors. Finaly I have my picture. Also I have noticed on long colums(above 12 tiles) I have a problem somtimes. Pics with color in the first tile and not too big work fine.
I have the latest IM on windows 7 64bit. I am useing a bat file since it takes a lot of lines to do this.
Thanks
Bob
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: assembling images

Post by fmw42 »

I looked a -merge but though it would not join the tiles right
The suggestion was montage and not merge. Montage will put them together edge to edge if you use -geometry +0+0. You can use -tile to set the number per row or column

What is the exact version of IM? The latest is 6.7.4.0

What happens when you do:

convert \( rose: -colorspace gray \) rose: rose: rose: +append rose_append.png


Append should work. Why do you have to convert to gif then png? why not right to png with -colors 127 PNG8:result.png

Post a few images that you want to append for which the first is grayscale and such that when you append them you get a grayscale result? Also post your command line that creates this.
svadagio
Posts: 7
Joined: 2011-12-11T12:54:36-07:00
Authentication code: 8675308

Re: assembling images

Post by svadagio »

OK here is the code from the bat file. I am using IM 6.7.4.0. Sorry for it being so long. I will post the images next. Put the code in a bat file. Put it and the images in a empty dir and exc.
Bob

convert A01.tif A02.tif -append charta.tif
convert charta.tif A03.tif -append charta.tif
convert charta.tif A04.tif -append charta.tif
convert charta.tif A05.tif -append charta.tif
convert charta.tif A06.tif -append charta.tif
convert charta.tif A07.tif -append charta.tif
convert charta.tif A08.tif -append charta.tif
convert charta.tif A09.tif -append charta.tif
convert charta.tif A10.tif -append charta.tif
convert charta.tif A11.tif -append charta.tif
convert charta.tif A12.tif -append charta.tif
convert charta.tif A13.tif -append charta.tif
convert charta.tif A14.tif -append charta.tif
convert charta.tif A15.tif -append charta.tif
convert B01.tif B02.tif -append chartb.tif
convert chartb.tif B03.tif -append chartb.tif
convert chartb.tif B04.tif -append chartb.tif
convert chartb.tif B05.tif -append chartb.tif
convert chartb.tif B06.tif -append chartb.tif
convert chartb.tif B07.tif -append chartb.tif
convert chartb.tif B08.tif -append chartb.tif
convert chartb.tif B09.tif -append chartb.tif
convert chartb.tif B10.tif -append chartb.tif
convert chartb.tif B11.tif -append chartb.tif
convert chartb.tif B12.tif -append chartb.tif
convert chartb.tif B13.tif -append chartb.tif
convert chartb.tif B14.tif -append chartb.tif
convert chartb.tif B15.tif -append chartb.tif
convert C01.tif C02.tif -append chartc.tif
convert chartc.tif C03.tif -append chartc.tif
convert chartc.tif C04.tif -append chartc.tif
convert chartc.tif C05.tif -append chartc.tif
convert chartc.tif C06.tif -append Chartc.tif
convert chartc.tif C07.tif -append chartc.tif
convert chartc.tif C08.tif -append chartc.tif
convert chartc.tif C09.tif -append chartc.tif
convert chartc.tif C10.tif -append chartc.tif
convert chartc.tif C11.tif -append chartc.tif
convert chartc.tif C12.tif -append chartc.tif
convert chartc.tif C13.tif -append chartc.tif
convert chartc.tif C14.tif -append chartc.tif
convert chartc.tif C15.tif -append chartc.tif
convert D01.tif D02.tif -append chartd.tif
convert chartd.tif D03.tif -append chartd.tif
convert chartd.tif D04.tif -append chartd.tif
convert chartd.tif D05.tif -append chartd.tif
convert chartd.tif D06.tif -append chartd.tif
convert chartd.tif D07.tif -append chartd.tif
convert chartd.tif D08.tif -append chartd.tif
convert chartd.tif D09.tif -append chartd.tif
convert chartd.tif D10.tif -append chartd.tif
convert chartd.tif D11.tif -append chartd.tif
convert chartd.tif D12.tif -append chartd.tif
convert chartd.tif D13.tif -append chartd.tif
convert chartd.tif D14.tif -append chartd.tif
convert chartd.tif D15.tif -append chartd.tif
convert E01.tif E02.tif _append charte.tif
convert charte.tif E03.tif -append charte.tif
convert charte.tif E04.tif -append charte.tif
convert charte.tif E05.tif -append charte.tif
convert charte.tif E06.tif -append charte.tif
convert charte.tif E07.tif -append charte.tif
convert charte.tif E08.tif -append charte.tif
convert charte.tif E09.tif -append charte.tif
convert charte.tif E10.tif -append charte.tif
convert charte.tif E11.tif -append charte.tif
convert charte.tif E12.tif -append charte.tif
convert charte.tif E13.tif -append charte.tif
convert charte.tif E14.tif -append charte.tif
convert charte.tif E15.tif -append charte.tif
convert F01.tif F02.tif -append chartf.tif
convert chartf.tif F03.tif -append chartf.tif
convert chartf.tif F04.tif -append chartf.tif
convert chartf.tif F05.tif -append chartf.tif
convert chartf.tif F06.tif -append chartf.tif
convert chartf.tif F07.tif -append chartf.tif
convert chartf.tif F08.tif -append chartf.tif
convert chartf.tif F09.tif -append chartf.tif
convert chartf.tif F10.tif -append chartf.tif
convert chartf.tif F11.tif -append chartf.tif
convert chartf.tif F12.tif -append chartf.tif
convert chartf.tif F13.tif -append chartf.tif
convert chartf.tif F14.tif -append chartf.tif
convert chartf.tif F15.tif -append chartf.tif
convert G01.tif G02.tif -append chartg.tif
convert chartg.tif G03.tif -append chartg.tif
convert chartg.tif G04.tif -append chartg.tif
convert chartg.tif G05.tif -append chartg.tif
convert chartg.tif G06.tif -append chartg.tif
convert chartg.tif G07.tif -append chartg.tif
convert chartg.tif G08.tif -append chartg.tif
convert chartg.tif G09.tif -append chartg.tif
convert chartg.tif G10.tif -append chartg.tif
convert chartg.tif G11.tif -append chartg.tif
convert chartg.tif G12.tif -append chartg.tif
convert chartg.tif G13.tif -append chartg.tif
convert chartg.tif G14.tif -append chartg.tif
convert chartg.tif G15.tif -append chartg.tif
convert H01.tif H02.tif -append charth.tif
convert charth.tif H03.tif -append charth.tif
convert charth.tif H04.tif -append charth.tif
convert charth.tif H05.tif -append charth.tif
convert charth.tif H06.tif -append charth.tif
convert charth.tif H07.tif -append charth.tif
convert charth.tif H08.tif -append charth.tif
convert charth.tif H09.tif -append charth.tif
convert charth.tif H10.tif -append charth.tif
convert charth.tif H11.tif -append charth.tif
convert charth.tif H12.tif -append charth.tif
convert charth.tif H13.tif -append charth.tif
convert charth.tif H14.tif -append charth.tif
convert charth.tif H15.tif -append charth.tif
convert I01.tif I02.tif -append charti.tif
convert charti.tif I03.tif -append charti.tif
convert charti.tif I04.tif -append charti.tif
convert charti.tif I05.tif -append charti.tif
convert charti.tif I06.tif -append charti.tif
convert charti.tif I07.tif -append charti.tif
convert charti.tif I08.tif -append charti.tif
convert charti.tif I09.tif -append charti.tif
convert charti.tif I10.tif -append charti.tif
convert charti.tif I11.tif -append charti.tif
convert charti.tif I12.tif -append charti.tif
convert charti.tif I13.tif -append charti.tif
convert charti.tif I14.tif -append charti.tif
convert charti.tif I15.tif -append charti.tif
convert J01.tif J02.tif -append chartj.tif
convert chartj.tif J03.tif -append chartj.tif
convert chartj.tif J04.tif -append chartj.tif
convert chartj.tif J05.tif -append chartj.tif
convert chartj.tif J06.tif -append chartj.tif
convert chartj.tif J07.tif -append chartj.tif
convert chartj.tif J08.tif -append chartj.tif
convert chartj.tif J09.tif -append chartj.tif
convert chartj.tif J10.tif -append chartj.tif
convert chartj.tif J11.tif -append chartj.tif
convert chartj.tif J12.tif -append chartj.tif
convert chartj.tif J13.tif -append chartj.tif
convert chartj.tif J14.tif -append chartj.tif
convert chartj.tif J15.tif -append chartj.tif
convert K01.tif K02.tif -append chartk.tif
convert chartk.tif K03.tif -append chartk.tif
convert chartk.tif K04.tif -append chartk.tif
convert chartk.tif K05.tif -append chartk.tif
convert chartk.tif K06.tif -append chartk.tif
convert chartk.tif K07.tif -append chartk.tif
convert chartk.tif K08.tif -append chartk.tif
convert chartk.tif K09.tif -append chartk.tif
convert chartk.tif K10.tif -append chartk.tif
convert chartk.tif K11.tif -append chartk.tif
convert chartk.tif K12.tif -append chartk.tif
convert chartk.tif K13.tif -append chartk.tif
convert chartk.tif K14.tif -append chartk.tif
convert chartk.tif K15.tif -append chartk.tif
convert charta.tif chartb.tif +append chart.tif
convert chart.tif chartc.tif +append chart.tif
convert chart.tif chartd.tif +append chart.tif
convert chart.tif charte.tif +append chart.tif
convert chart.tif chartf.tif +append chart.tif
convert chart.tif chartg.tif +append chart.tif
convert chart.tif charth.tif +append chart.tif
convert chart.tif charti.tif +append chart.tif
convert chart.tif chartj.tif +append chart.tif
convert chart.tif chartk.tif +append chart.tif
convert chart.tif -colors 127 chart.jpg
convert chart.jpg -colors 127 chart.gif
convert chart.gif -colors 127 chart.tif
convert chart.jpg -colors 127 chart.png
del *.A*
del *.B01, *.B02, *.B03, *.B04, *.B05, *.B06, *.B07, *.b08, *.B09, *.B10, *.B11, *.B12, *.B13, *.B14, *.B15
del *.C*
del *.D*
del *.E*
del *.F*
del *.G*
del *.H*
del *.I*
del *.J*
del *.K*
del A*.tif
del B*.tif
del C0*.tif, C1*.tif
del D*.tif
del E*.tif
del F*.tif
del G*.tif
del H*.tif
del I*.tif
del J*.tif
del K*.tif
del charta.tif, chartb.tif, chartc.tif, chartd.tif, charte.tif, chartf.tif, chartg.tif, charth.tif, charti.tif, chartj.tif, chartk.tif
del chart.gif
end
svadagio
Posts: 7
Joined: 2011-12-11T12:54:36-07:00
Authentication code: 8675308

Re: assembling images

Post by svadagio »

Well I can not see how to attach the images. Can you give me an email and I will send them. They are tiff files.

The reason for the extra conversion is the next program will not use the tif if it is created straight. Something about the number of colors has to be less than 128. Doing it this way works so for now I don't worry about that until this problem is fixed.
Bob
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: assembling images

Post by fmw42 »

I don't want to have 100 images. All I ask is that you skip the Bat file and just append a few images (3 or 4) in command line mode showing that if the first image is gray and the rest are color that the result is gray. I am not a Windows person so having your Bat file would do me no good. I want to first confirm that the problem is with IM.

Then post the IM command and image. You cannot post images here directly. You need to find some free hosting service for images, such as dropbox, or many others -- just google for them. Then once you have posted the image there, you simply put a link to it in your post here.


Please clarify why you do:

convert chart.tif -colors 127 chart.jpg
convert chart.jpg -colors 127 chart.gif
convert chart.gif -colors 127 chart.tif
convert chart.jpg -colors 127 chart.png


Why convert from tif to jpg to gif to tiff (again) to png. Why not just go to

convert chart.tif -colors 127 PNG8:chart.png

Does each result (jpg, gif, tif, png) all show that the results are grayscale for all the images involved?

I have tried all the above formats for the result of appending one grayscale and several color versions of the rose: image and none of them end up all grayscale.

Again what exact version are you using of IM. It works fine for me with IM 6.7.4.0 Q16
svadagio
Posts: 7
Joined: 2011-12-11T12:54:36-07:00
Authentication code: 8675308

Re: assembling images

Post by svadagio »

Hi
I have IM 6.7.4.0 Q16. X64 Downloaded a few days ago. I installed new when I thoughit might be a bad file.

The conversion from tif to jpg is to get a jpg. The conversion from jpg to gif to tif is to get 127 colors and a format that the next program accepts. While I am sure there is an easier way this works. If I do not do this the next program fails. The conversion for Jpg to png is to get the png for differant program.

I am sorry I can not reproduce the error with a few files. I have discovered that it happens when the number of files to _append in column is above 12, but sometimes less. This problem is occuring at the time the images are -appended in columns and carried foward in the process. Columns that have color are turned B&W when the +append joins columns and the first is B&W.

I am going to try the montage and see if it works. I will let you know.

Bob
svadagio
Posts: 7
Joined: 2011-12-11T12:54:36-07:00
Authentication code: 8675308

Re: assembling images

Post by svadagio »

Hi
OK I rewrote it using montage and it works fine. Thank You

As far as the conversions go the mesage I get from the other program is "color is photometric=2, only files with color maps are supported" I solved this by the multiple conversions. If you have an easier way I would appreciate it. It must be 127 colors max.

Thanks
Bob
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: assembling images

Post by fmw42 »

Out of curiosity which format (jpg, tif, gif, png) fails or do they all when using -append with more than 12 images?

I have not been able to reproduce this problem with 17 images with -append where the first one is grayscale.
svadagio
Posts: 7
Joined: 2011-12-11T12:54:36-07:00
Authentication code: 8675308

Re: assembling images

Post by svadagio »

The problem seems to occur when the images are assembled into columns. It carries forward from there. I assemble the columns into one pic second. All of this work is done in tif. I do not convert until later.
Bob
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: assembling images

Post by fmw42 »

svadagio wrote:The problem seems to occur when the images are assembled into columns. It carries forward from there. I assemble the columns into one pic second. All of this work is done in tif. I do not convert until later.
Bob

As I said above I tried appending 17 images vertically (one column) with the first image being grayscale and the others color and saved in tiff. Everything worked fine.

Is it possible that you have a mix of RGB and CMYK input images? That may cause problems. Perhaps in your command add -colorspace RGB just before the -append and see what happens?

Can you post links to a few (not too many) images and your command line for a case where it fails and the resulting failed image?
Post Reply