我认为Photoshop内置的File-> Automate-> Contact Sheet II不足以满足您的需求... I am looking for a script that would open a given number of images with different aspect ratios and layout them all in a single document like the flickr gallery. Something as seen in this page: http://martin-oehm.de/data/layout.htmlIs there any script/plugin out there that can do this? The purpose is just to create a reference file with all the images instead of having several images floating around.Thank you 解决方案 The fact that you have had no answers in 10 weeks should tell you that Photoshop is maybe not the best/easiest place to do this.... so, I made the following script that does it pretty well outside of Photoshop.It assumes you have OSX or Linux to run a bash script and it uses ImageMagick to actually do the image processing.#!/bin/bash################################################################################# layout# Mark Setchell## Layout all images in current directory onto contact sheet. Algorithm is crude# but fairly effective as follows:## Create temporary workspace# Resize all images to standard HEIGHT into workspace saving names & new widths# row=0# Repeat till there are no images# Repeat till row is full# Append widest image that will fit to this row# End repeat# Append this row to output contact sheet# row++# End repeat################################################################################WORKSPACE=layout-$$.dHEIGHT=300WIDTH=2000PAD=50shopt -s nullglobshopt -s nocaseglob# Declare our arraysdeclare -a namesdeclare -a widthdeclare -a indices################################################################################# Returns the number of images remaining still to be laid out################################################################################NumRemaining(){ local result=0 local z for ((z=0;z<${#width[@]};z++)) do if [ ${width[z]} -gt 0 ]; then ((result++)) fi done echo $result}################################################################################# Returns index of widest image that fits in specified width################################################################################BestFitting(){ local limit=$1 local index=-1 local widest=0 local z local t for ((z=0;z<${#width[@]};z++)) do t=${width[z]} if [[ $t -gt 0 && $t -le $limit && $t -gt $widest ]]; then widest=$t index=$z fi done echo $index}mkdir $WORKSPACE 2> /dev/nulln=0for f in *.jpg *.png *.gif *.psd; do # Save name names[n]=$f # Extract file extension and basic name, because we want to add "[0]" to end of PSD files ext="${f##*.}" base="${f%.*}" echo $ext | tr "[A-Z]" "[a-z]" | grep -q "psd$" if [ $? -eq 0 ]; then convert "$f[0]" -resize x${HEIGHT} $WORKSPACE/${n}.jpg else convert "$f" -resize x${HEIGHT} $WORKSPACE/${n}.jpg fi # Get width of the resized file and save width[n]=$(identify -format "%w" $WORKSPACE/${n}.jpg) echo DEBUG: Index: $n is file: $f thumbnailed to width: ${width[n]} ((n++))doneecho DEBUG: All images addedechocd "$WORKSPACE"row=0while [ $(NumRemaining) -gt 0 ]; do echo DEBUG: Processing row $row, images left $(NumRemaining) remaining=$WIDTH # new row, we have the full width to play with cumwidth=0 # cumulative width of images in this row i=0 # clear array of image indices in this row while [ $remaining -gt 0 ]; do best=$(BestFitting $remaining) if [ $best -lt 0 ]; then break; fi indices[i]=$best # add this image's index to the indices of images in this row w=${width[best]} ((cumwidth=cumwidth+w)) ((remaining=WIDTH-cumwidth-i*PAD)) # decrease remaining space on this line width[best]=-1 # effectively remove image from list ((i++)) echo DEBUG: Adding index: $best, width=$w, cumwidth=$cumwidth, remaining=$remaining done if [ $i -lt 1 ]; then break; fi # break if no images in this row PADWIDTH=$PAD if [ $i -gt 1 ]; then ((PADWIDTH=(WIDTH-cumwidth)/(i-1))); fiecho $(NumRemaining)echo $i if [ $(NumRemaining) -eq 0 ]; then PADWIDTH=$PAD; fi # don't stretch last row echo DEBUG: Padding between images: $PADWIDTH ROWFILE="row-${row}.png" THIS="${indices[0]}.jpg" # Start row with left pad convert -size ${PAD}x${HEIGHT}! xc:white $ROWFILE for ((z=0;z<$i;z++)); do if [ $z -gt 0 ]; then # Add pad to right before appending image convert $ROWFILE -size ${PADWIDTH}x${HEIGHT}! xc:white +append $ROWFILE fi THIS="${indices[z]}.jpg" convert $ROWFILE $THIS +append $ROWFILE done # End row with right pad convert $ROWFILE -size ${PAD}x${HEIGHT}! xc:white +append $ROWFILE ((row++)) echo DEBUG: End of row echodone# Having generated all rows, append them all together one below the next((tmp=WIDTH+2*PAD))convert -size ${tmp}x${PAD} xc:white result.pngfor r in row*.png; do convert result.png $r -size ${tmp}x${PAD}! xc:white -append result.pngdoneopen result.pngDepending on the files in your input directory (obviously), it produces output like this:with debug information in your Terminal window as it goes like this:DEBUG: Index: 0 is file: 1.png thumbnailed to width: 800DEBUG: Index: 1 is file: 10.png thumbnailed to width: 236DEBUG: Index: 2 is file: 11.png thumbnailed to width: 236DEBUG: Index: 3 is file: 12.png thumbnailed to width: 360DEBUG: Index: 4 is file: 2.png thumbnailed to width: 480DEBUG: Index: 5 is file: 3.png thumbnailed to width: 240DEBUG: Index: 6 is file: 4.png thumbnailed to width: 218DEBUG: Index: 7 is file: 5.png thumbnailed to width: 375DEBUG: Index: 8 is file: 6.png thumbnailed to width: 1125DEBUG: Index: 9 is file: 7.png thumbnailed to width: 1226DEBUG: Index: 10 is file: 8.png thumbnailed to width: 450DEBUG: Index: 11 is file: 9.png thumbnailed to width: 300DEBUG: Index: 12 is file: a.png thumbnailed to width: 400DEBUG: All images addedDEBUG: Processing row 0, images left 13DEBUG: Adding index: 9, width=1226, cumwidth=1226, remaining=774DEBUG: Adding index: 4, width=480, cumwidth=1706, remaining=244DEBUG: Adding index: 5, width=240, cumwidth=1946, remaining=-46DEBUG: Padding between images: 27DEBUG: End of rowDEBUG: Processing row 1, images left 10DEBUG: Adding index: 8, width=1125, cumwidth=1125, remaining=875DEBUG: Adding index: 0, width=800, cumwidth=1925, remaining=25DEBUG: Padding between images: 75DEBUG: End of rowDEBUG: Processing row 2, images left 8DEBUG: Adding index: 10, width=450, cumwidth=450, remaining=1550DEBUG: Adding index: 12, width=400, cumwidth=850, remaining=1100DEBUG: Adding index: 7, width=375, cumwidth=1225, remaining=675DEBUG: Adding index: 3, width=360, cumwidth=1585, remaining=265DEBUG: Adding index: 1, width=236, cumwidth=1821, remaining=-21DEBUG: Padding between images: 44DEBUG: End of rowDEBUG: Processing row 3, images left 3DEBUG: Adding index: 11, width=300, cumwidth=300, remaining=1700DEBUG: Adding index: 2, width=236, cumwidth=536, remaining=1414DEBUG: Adding index: 6, width=218, cumwidth=754, remaining=1146DEBUG: Padding between images: 623DEBUG: End of rowUpon reflection, the output could maybe be improved by reversing odd-numbered rows so that the largest image on each line is on the left one time and on the right the next time - it is a simple change but I don't want to over-complicate the code. Basically, you would reverse the order of the array indices[] every second time you fall out of the row-assembling loop.Here are some maybe useful links:Google+ algorithmflickr algorithm in jQueryI presume Photoshop's built-in File->Automate->Contact Sheet II is inadequate for your purposes... 这篇关于Photoshop Script:像flickr一样的布局图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-12 17:30