On Thu, 10 Sep 2009 19:09:59 -0700 Glenn Linderman <[email protected]> wrote:
| Thanks for your response, Fred... I'll try to explain, as you suggest. | I'm sure I have something wrong, but then again, it seems IM is doing | something wrong too. Maybe they are related, or maybe not. | | On approximately 9/10/2009 9:31 AM, came the following characters from | the keyboard of Fred Weinhaus: | > I don't really follow this, but it appears that you have the order of | > images wrong and am missing a -composite or -flatten with the first | > -compose multiply. | > | > The convert syntax is | > | > convert background overlay -compose method -composite | > | > Below you create a white image, but don't follow with the overlay | > image until after the -compose multiply and then there is no | > -composite (or you have an out of place -compose multiply after the | > xc:white and then again after the in.jpg with a -compose multiply | > -flatten. When you have missed a composite command, you end up with | > multiple outputs rather than the two image being composited into one | > image. | > | > see http://www.imagemagick.org/Usage/compose/#compose | > | > | > Perhaps I am missing something here, but your command does not make | > sense to me. Perhaps it worked before because IM was more forgiving | > of errors and ignored the misplaced -compose multiply. | > | > Perhaps you can explain functionally what you are trying to do and | > what each step corresponds to. | > | | Below, I will carve up my command, and explain what I think, which may | not be correct. You can correct me. | | > Also you say things are twice as big, but your image is 750x750 but | > you are usinig a 1159x1515 size white image. So the result will | > likely be that big. | > | | Yes, I expect the result to be 1159x1515. But I don't expect that | in.jpg, which is 750x750, will get doubled in size, and consume | 1500x1500, in each case, and be therefore cropped. Both copies of | in.jpg should fit, non-overlapping, within 1159x1515, at the positions I | specified. I think one should be in the upper left corner, and one in | the lower right corner. | | >> convert.exe -density 150 -size 1159x1515 xc:white -compose multiply ( | >> in.jpg -repage 1159x1515+0+0 ) -compose multiply -flatten ( in.jpg | >> -repage 1159x1515+409+765 ) -compose multiply -flatten -compress zip out.tif | | Here's my command, split into pieces, with explanations after the # | | convert.exe # run the program | -density 150 -size 1159x1515 xc:white # make a white canvas of the final size | -compose multiply # probably not needed | ( in.jpg -repage 1159x1515+0+0 ) -compose multiply -flatten # in.jpg to upper left | ( in.jpg -repage 1159x1515+409+765 ) -compose multiply -flatten # in.jpg bottom right | -compress zip out.tif # save result | You method actually has 4 image compositions, and three canvas creations! It also losses whatever metadata you had in the image (effectivally stripping it). This may be the cause of your problems! In reality you only want 2 image compositions and one canvas creation! Try this instead... convert.exe \ -page +0+0 in.jpg \ -page +409+765 in.jpg \ -repage 1159x1515 -background white -compose multiply -flatten \ -compress zip -density 150 out.tif What you have to remember is that -flatten always creates a canvas of the current background color the size of the first images virtual canvas. So you do not need to create that canvas yourself. The -page setting saves the 'virtual page' and 'virtual offset' into any images created after it. While -repage does the same but for image already in memory. The above also has the effect that the meta-data of the first image will be preserved, where in what you have the meta-data will be lost. Perhaps part of that meta-data was a Photoshop profile with image resolution! The above will preserve that unless you add -strip. The above is actually equivalent in some ways to convert.exe in.jpg -background white -compose multiply -extent 1159x1515 \ in.jpg -geometry +409+765 -compose multiply -composite \ -compress zip -density 150 out.tif BOTH methods preserve that meta data and only use two image compositions. That is -extent does one image composition too, also generating the background canvas from the image given so as to preserve its meta data. If you know the second image should be in the bottom right corner you can let IM calculate the offset needed! convert.exe in.jpg -background white -compose multiply -extent 1159x1515 \ in.jpg -gravity SouthEast -compose multiply -composite \ -compress zip -density 150 out.tif The second -compose setting isn't really needed, but it is better to always be given before it is needed, (and reset to 'over' when it isn't). There are lots of ways to skin a cat, and what method you use depends on what you want that skin for, and how messy you like the results! -- Anthony Thyssen Anthony Thyssen ( System Programmer ) <[email protected]> ----------------------------------------------------------------------------- A novice practices until he gets it right. An expert practices until he doesn't get it wrong. ----------------------------------------------------------------------------- Anthony's Home is his Castle http://www.cit.gu.edu.au/~anthony/ _______________________________________________ Magick-users mailing list [email protected] http://studio.imagemagick.org/mailman/listinfo/magick-users
