On Mon, 18 May 2009 15:44:42 +0200 Axel Rosenski <[email protected]> wrote:
| Hi there, | | this is my first Post on this list and I hope you can help me. | | I'm running Imagemagick (Version: ImageMagick 6.4.3 2008-12-03 Q16 OpenMP | http://www.imagemagick.org) on a linux machine and I have a set of | Photoshopimages in varying sizes that I would like to convert into JPG. | | I have to extract a clipping path, put it in the middle on a blue canvas with | a size of 2000x2000 pixel and save this image, resize it in the next step and | add a watermark image. I like to do this with one convert/composite call. | | I found two (nonsatisfying) solutions: | | > convert -size 2000x2000 /path/to/foto.psd[0] -flatten -resize 2000x2000 | xc:blue -gravity center +swap -composite -write /path/to/test.jpg -resize | 450x450 -write /path/to/test450.jpg -resize 200x200 /path/to/test200.jpg | | This creates me a canvas of 2000x2000px and resizes my images to the given | size. When I try to add my watermark I get a proper test.jpg, but test450.jpg | gets completely white. | | The other solution I found out is: | | | >convert "foto.psd[1]" -fill "blue" -resize "2000x2000" -size "2000x2000" | xc:"blue" +swap -gravity "Center" -flatten -write "/path/to/test.jpg" - | composite -gravity "center" "/path/to/watermarkimage" -resize "450x450" -write | "path/to/test450.jpg" -delete 1 -resize "200x200" "/path/to/test200.jpg" | | With this call I have two problems: | - the clipping path image is not centered in the middle of the image | - the medium and small images are not usable. | They have a black background with a white bar in the foreground where the | watermarkimage should be. I played around with some options (-draw 'color 0,0 | floodfill' changed position of command line options). | | Can anyone help me to get those two calls together? | First it would have been better if you could have formated your command into multiple lines so one major image processign step is on each line. That makes it a LOT easier to read! Second a canvas is NOT needed for -flatten, as it will create a canvas as part of its processing. Also -flatten does NOT understand -gravity. That is a composite setting not a image layering setting. For info see Composite Geometry/Gravity vs Layer Canvas/Page Offsets http://www.imagemagick.org/Usage/compose/#geometry Also look at examples on flattening, with canvas adjustments (using -page) http://www.imagemagick.org/Usage/layers/#flatten Another alternation is to use -extent whcih will also use a composition But does understand -gravity. See http://www.imagemagick.org/Usage/crop/#extent Later you read in your water mark but you don't compose it onto the image! Downloading images.. | If you need an image for testing purposes you can get it at: | | http://ar.nutzerverwaltung.de/foto.psd (careful, it has ~33 MB) | The watermarkimage is available here: | http://ar.nutzerverwaltung.de/stempel_axel.png Sorry your image was HUGE, and was not yet downloaded causing the above error. It als also far larger than 2000x2000. I gather than you want that image to fit into 2000x2000, and not be clipped by it, seeing as it already has transparency. Continuing study... convert 'foto.psd[0]' -resize 2000x2000 \ -gravity center -background blue -extent 2000x2000+0+0 \ stempel_axel.png -gravity center -composite \ \( +clone -resize 450x405 -write test450.jpg +delete \) \ \( +clone -resize 200x200 -write test200.jpg +delete \) \ test.jpg First note how I organized the command. Making each line a major processing step, alloting it to be read much more easilly by others. Including yourself months later! Also note that I avoided resizing a resize. Resize is a major image distioning operation and avoiding multiple distorts is always a good thing. PS: to make it look more natural ass a wave distortion See http://www.imagemagick.org/Usage/warping/#wave Note the wave length is twice the image width to make an 'arch' See http://www.imagemagick.org/Usage/fonts/#arch convert 'foto.psd[0]' -resize 2000x2000 \ -gravity center -background blue -extent 2000x2000+0+0 \ \( stempel_axel.png -background none -wave 17x700 \) -gravity center -geometry -10-20 -composite \ \( +clone -resize 450x405 -write test450.jpg +delete \) \ \( +clone -resize 200x200 -write test200.jpg +delete \) \ test.jpg I'll leave you to adjust the wave and geometry offset better ;-) PS: a -wave distortion is not the correct solution for a cylindrical object. But this only becomes noticable close to the edges of the cylinder. For our purposes wave should be close enough. See IM forum discussion http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=13569 I do hope to add a true cylindrical distortion to IM sometime. Anthony Thyssen ( System Programmer ) <[email protected]> ----------------------------------------------------------------------------- "I have a top secret gravely important assignment here." "What other kind do I ever get?" -- Stainless Steel Rat (Revenge) ----------------------------------------------------------------------------- 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
