Redimensionner un répertoire

Discussions on NConvert - the command line tool for image conversion and manipulation

Moderators: helmut, XnTriq, xnview

Post Reply
VinceBR
Posts: 4
Joined: Thu Jul 24, 2014 1:07 pm

Redimensionner un répertoire

Post by VinceBR »

Bonjour,
J'ai regardé les divers sujets NConvert qui se rapprochent de mon besoin, mais je n'arrive pas à trouver la bonne syntaxe.
Pour quelqu'un qui ne maîtrise pas trop la gestion d'un ordinateur (navigation dans l'explorateur, création de répertoires...), je souhaite ajouter un script NConvert qui, par clic droit sur un répertoire de photos jpg, y génère un sous-répertoire "1024" qui contient les photos avec un nom identique, mais de taille 1024 au maximum.

La ligne suivante dans le registre

Code: Select all

"C:\Program Files\XnView\nconvert.exe" -ratio -rtype lanczos -rflag decr -resize 1024 768 -o $\1024\ "%1\*.jpg"
me crée bien le sous-répertoire 1024, chaque photo est bien réduite, mais la première porte le nom ".jpg", la seconde "_1.jpg", ... et pas les noms des fichiers originaux.

Une petite astuce pour finaliser le résultat ?
Merci d'avance,
Vince
cday
XnThusiast
Posts: 4396
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Redimensionner un répertoire

Post by cday »

VinceBR wrote:Une petite astuce pour finaliser le résultat ?
Bonjour,

NConvert does not support the use of quotes (" ") with wildcards (*) as in "%1\*.jpg" ... :(

You can probably avoid the limitation by using a 'DOS' For ... In ... Do ... loop around NConvert code in a batch file .bat ...
VinceBR
Posts: 4
Joined: Thu Jul 24, 2014 1:07 pm

Re: Redimensionner un répertoire

Post by VinceBR »

Thanks cday.
After a few searches on the Internet for DOS loops, I finally obtained a good solution.

The registry (right-click on photo folders) points to a .bat file, which contains the following code :

Code: Select all

cd "%1"
FOR %%i IN (*.jpg) DO "C:\Program Files\XnView\nconvert.exe" -ratio -rtype lanczos -rflag decr -resize 1024 768 -o $\1024\%%_1024.jpg %%i
My mother is happy with this solution, and my wife should be also, when back home !!! ;-)

I tried XnConvert as well. I noticed a difference in size between the results of NConvert and XnConvert. Both seems to be jpeg at 80%. I don't know where it comes from.
User avatar
XnTriq
Moderator & Librarian
Posts: 6512
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Redimensionner un répertoire

Post by XnTriq »

VinceBR wrote:I tried XnConvert as well. I noticed a difference in size between the results of NConvert and XnConvert. Both seems to be jpeg at 80%. I don't know where it comes from.
A “Q factor” of 80 is XnConvert's default compression level for JPEG.

What are your other settings in Output » Format » JPG - JPEG / JFIF, Vince :?:

JPEG options in NConvert:
  • -q value : JPEG/PNG/FPX/WIC/PDF quality (default : 100)
    -i : Interlaced GIF / Progressive JPEG
    -opthuff : Optimize Huffman Table (JPEG)
    -dct value : DCT method
    • 0 : Slow
      1 : Fast
      2 : Float
    -smoothingf value : Smoothing factor (0-10)
    -subsampling value : Subsampling factor
    • 0 : 2x2,1x1,1x1
      1 : 2x1,1x1,1x1
      2 : 1x1,1x1,1x1
    -jpegtrans op : JPEG lossless transformations
    • rot90 : Rotate 90 degrees
      rot180 : Rotate 180 degrees
      rot270 : Rotate 270 degrees
      exif : Use orientation EXIF tag
      vflip : Flip vertical
      hflip : Flip horizontal
    -jpegcrop x y w h : JPEG lossless crop
    -clean value : JPEG Clean Metadata (EXIF/IPTC/...)
    • 1 : Comment
      2 : EXIF
      4 : XMP
      8 : EXIF thumbnail
      16 : IPTC
      32 : ICC Profile
      64 : Other markers
    -rmeta : Remove Metadata (EXIF/IPTC/...)
    -rexifthumb : Remove EXIF thumbnail
What JPEG compression level does NConvert use by default, Pierre :?:
durumdara ([url=http://newsgroup.xnview.com/viewtopic.php?t=16703&p=70210#p70210]Why new sizes are less than original?[/url]) wrote:Interesting, because the help said that -q 100 default.
But if I forget to set it to 100, I got another result... Hmmmmm...
Possible that help is wrong in this param?
reebear ([url=http://newsgroup.xnview.com/viewtopic.php?t=28180&p=111975#p111975]Creating JPEGs from Camera RAW files[/url]) wrote:Also - despite the fact that for JPEG, a quality setting of 100 should be default, setting it to -q 100 actually increases the filesize compared to omitting the parameter.
User avatar
XnTriq
Moderator & Librarian
Posts: 6512
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Redimensionner un répertoire

Post by XnTriq »

XnTriq wrote:What JPEG compression level does NConvert use by default, Pierre :?:
OK, the default value seems to be 85.
Post Reply