Can you clarify some points? How do you plan on arranging the images in the sprite file? How will you keep track of the positions?
The simplest way I know is to sequentially append the files into one long image. convert image1 image2 -background black +append result convert result image3 -background black +append result etc. This will append the images side by side and if the images are not the same size, then will fill with black in this case. The height of the result image will always be the height of the tallest image. P.S. If you want to know the horizontal position for the start of the next image to be added, then after each append, you can run convert result -format %w info: which will tell you the width of the current result, which will be the start position of the next image to be appended. In fact you can write this to a file and keep a list of the start coordinates: convert result -format %w info: >> sprite_startx.txt P.S. Again You can also keep a file of the image widthxheight dimensions by convert image1 -format "%w,%h" info: >> sprite_dimensions.txt convert image2 -format "%w,%h" info: >> sprite_dimensions.txt etc >For a web site I have a tool that combines and compresses CSS files >into a single file. Since the source CSS files are in different >directories than the destination CSS file and the files include >relative links I have to rewrite all css url() links that are in the >css file. > > >Since I have access to all the background images while running this >tool I would like to build a sprite file (a single image that contains >multiple images). Then I would replace the url() links with a link to >the new sprite file and provide coordinates of the specific image >within the sprite. > >Is there any need to do this in two passes (i.e. to find the size of >the larges image)? Or is it possible to just add each image to the >sprite one image at a time, incrementally building up the final image? > >Thanks for any tips you can provide, _______________________________________________ Magick-users mailing list [email protected] http://studio.imagemagick.org/mailman/listinfo/magick-users
