Al Bogner wrote:
> 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

It's got nothing to do with IM.  If you need quotes around the file 
names, then you must have special characters in the file names, like

        "This is the file.tiff"

Such filenames, while very normal on Windows, are very unusual on Linux 
because they're a PITA.

>>      ...
>>      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'

Perhaps something in the TIFF file that IM doesn't grok.  I have that 
problem with some files my graphic artist creates--I've learned to just 
ignore them...

> I tried to specify the biggest file with
> 
> BIGGEST=`identify -format "%w %n\n" "$INP" | \
> sort -g | tail -1 | cut -f 2 -d" "`

I assume you're getting more than one data line out of this because you 
have multiple frames.

I get one line with data followed by one blank line from identify when I 
try this on various TIFF files I have.  In my case, I would use

BIGGEST=$(identify -format %n $INP)

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

OK, you have a special character here, so you need the quotes around the 
square brackets.  Try this:

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

Quotes ARE needed around the first argument because of the "[" and "]"
Quotes ARE needed around the resize value because of the ">"
Quotes ARE ONLY needed around $NEWFILE if it too has special characters.

> 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?

Are you trying to create a variable PROBLEMATIC that has multiple 
NEWFILES in them, that you want to list one at a time?  For example, 
would PROBLEMATIC look like

        file1.tiff file2.tiff file3.tiff

To create PROBLEMATIC, use this:

        PROBLEMATIC="$PROBLEMATIC $NEWFILE"

Be aware that this will actually create

        " file1.tiff file2.tiff file3.tiff"

Note the leading blank?  That is why I DID NOT use quotes in the 
examples below.  Again, know WHEN to use quote and WHEN NOT to use 
quotes.  You're a little quote-happy above ;)

You can write PROBLEMATIC one name per line many ways.  Three examples are:

        echo $PROBLEMATIC | sed "s/ /\n/g"
or
        echo $PROBLEMATIC | tr " " "\n"
or
        for n in $PROBLEMATIC ; do echo $n;done

I prefer the first because I'm a sed bigot.  sed can do ANYTHING.

-- 
dnl
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to