Re: "Intelligent" resize

Al Bogner <[email protected]>
Newsgroups gmane.comp.video.image-magick.user
Message-ID <[email protected]>
Am Freitag, 20. November 2009 23:11:51 schrieben Sie:

Hi David,

> >> convert image -resize 1800x1800 resultimage
> >>
> >> will always make the larger side 1800 and the other (smaller side)
> >> stay in proportion
> >
> > I tried this and it _enlarges_ the image:
> >
> > for INP in `find "$ORIGINALPATH" -type f \
> > -regex ".*\(jpg\|jpeg\|png\|tif\|tiff\|gif\)" | sort`; do
> > 	NEWFILE=`echo "$INP" | sed 's/originals/gallery/'`
> > 	NEWFILE="${NEWFILE%.*}"".jpg"
> > 	NEWDIR=`dirname "$NEWFILE"`
> > 	mkdir -p "$NEWDIR"
> > 	echo "creatIng "`basename "$NEWFILE"`
> > 	convert "$INP" -resize 1800x1800 "$NEWFILE"
> > done
> 
> 	-resize 1800x1800>
> 
> <http://www.imagemagick.org/script/command-line-processing.php#geometry>
> 
> 
> BTW, quoting is only needed to protect special characters:

It doesn't work without quoting here!
Version: ImageMagick 6.4.3 2009-07-03 Q16 OpenMP

> 
> 	...
> 	NEWFILE=${NEWFILE%.*}.jpg
> 	mkdir -p $(dirname NEWFILE)
> 	echo creatIng ${NEWFILE#*/}
> 	convert $INP -resize 1800x1800> $NEWFILE
> 
> dirname(1) has the advantage of returning "." if no path is found.  If
> you *always* have a path component, then
> 
> 	mkdir -p ${NEWFILE%/*}
> 
> is better/faster/cheaper.

Thanks, at the moment I am unsure what could happen. It are so different files 
(not from me).

I have problems with Tiff-files, which create the warning:
unknown field with tag 317 (0x13d) encountered. `TIFFReadDirectory'

I tried to specify the biggest file with

BIGGEST=`identify -format "%w %n\n" "$INP" | \
sort -g | tail -1 | cut -f 2 -d" "`

convert "$INP"[$BIGGEST] -resize "1280x1024>" "$NEWFILE"

But the biggest file was not chosen always. So I make a warning list at the 
end, which can be corrected manually. The user has to check this problem 
himself.

I create a variable
PROBLEMATIC="$PROBLEMATIC""$NEWFILE""  |  "

How can I create an output, which lists every file in a new line?

Al
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.