Announcement

Collapse
No announcement yet.

Need help with filelist and renaming

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Need help with filelist and renaming

    Here's the background so you'll understand what my goal is. We have several storage servers that we're trying to free up space on. Upon analysis on each server, the thing taking up the most space is usually jpgs. Employees upload images with whatever settings they were taken with. I've found that dropping the quality to 70% and resizing to 75% doesn't cause any quality loss but it reduces size by 90%. WIN!

    What I need to do: find all the jpgs in a directory that has 100s of subfolders and then resize/quality and rename the file (append something to show it's been resized, like _rz) for each one. I'm pretty much almost there I think.

    I'm doing dir *.jpg /b /s >> jpglist.txt to get my list. It looks like this:

    C:\1tmp\pics\Joffrey\Pictures\2008\Finning BFP_5.JPG
    C:\1tmp\pics\Joffrey\Pictures\2008\Finning BFP_6.JPG
    C:\1tmp\pics\Joffrey\Pictures\2008\Finning BFP_7.JPG

    Here's the command I'm trying to use
    i_view32.exe /filelist=c:\1tmp\jpglist.txt /resize=(75p,75p) /jpgq=70


    It run's but it doesn't seem to be changing the files... the process just keeps running in the background.

    HELP!

    #2
    Example:
    "c:\irfanview\i_view32.exe" /filelist=c:\1tmp\jpglist.txt /resize=(75p,75p) /jpgq=70 /resample
    When I run this from the prompt, i_view32.exe runs for 10 minutes and it uses my cpu so you'd think something was happening, but it makes absolutely no change to the pictures. What am I doing wrong??? I even setup batch process and can get it doing exactly what I want through the gui. Then I saved the INI and used /advancedbatch and it still doesn't actually do anything to the images when run through the command prompt!?!? I also tried to add /convert=c:\temp\*.jpg to see if it was just having an issue when you want to change the original but that doesn't actually change the jpg or output anything either.

    Comment


      #3
      You do need the /convert bit so that irfanview knows where to put the results.
      I would expect
      "c:\irfanview\i_view32.exe" /filelist=c:\1tmp\jpglist.txt /resize=(75p,75p) /jpgq=70 /resample /convert=c:\temp\*.jpg
      to work though.

      Are you running it directly from the Command prompt? If so are there any error messages?

      Comment


        #4
        Yes directly from the command prompt but no error messages. The things is, I don't want new files output. I want to change and rename the original. The renaming is just so in the future we'll know that this file has already been changed. How do I tell it overwrite the original files?

        On another note but same topic, I'm trying to do the same thing with the GUI as a batch. Once I figured out that it would find the files in subfolders, I realized that I didn't HAVE to do it from command prompt (although it'd be cooler). The issue I have when trying to do it with the GUI is that unless I do two steps (one convert and one rename) then I end up with still having the original and the new renamed copy. If I select "batch conversion - rename result files" its grays out the Batch Rename Options to rename the original. What's up with that? Anyways to get around this with the right fields selected? I've got 3 servers with thousands of folders with hundreds of JPGs. If I can just start it on a machine and let it run overnight, it'd be really beneficial. It'll be a huge pain to have to do two steps!

        Comment


          #5
          Originally posted by tones321 View Post
          The things is, I don't want new files output. I want to change and rename the original. The renaming is just so in the future we'll know that this file has already been changed. How do I tell it overwrite the original files?
          I do not know of a way to have Irfanview put a whole set of modified files back into the same folders that they came from within a batch file, although of course it would be possible to write the batch file itself so that it takes each file name in turn from the list and has Irfanview process them one at a time.

          On another note but same topic, I'm trying to do the same thing with the GUI as a batch. Once I figured out that it would find the files in subfolders, I realized that I didn't HAVE to do it from command prompt (although it'd be cooler). The issue I have when trying to do it with the GUI is that unless I do two steps (one convert and one rename) then I end up with still having the original and the new renamed copy. If I select "batch conversion - rename result files" its grays out the Batch Rename Options to rename the original. What's up with that? Anyways to get around this with the right fields selected? I've got 3 servers with thousands of folders with hundreds of JPGs. If I can just start it on a machine and let it run overnight, it'd be really beneficial. It'll be a huge pain to have to do two steps!
          You can do what you want that way. I have attached an image of the settings you will need. Note that you leave the Outut directory box blank. The Create subdirectories option in the Advanced options does the job for you.

          You cannot set the jpeg quality in the Advanced batch dialog - it uses whatever setting is stored in the Jpeg Save options. To set that you need to open a jpeg file in the Viewer, press File >Save As.. and select type jpg. Open the Save Options if not already displayed and set quality to 70. You must actually Save the jpeg file for the settings to be stored, so make sure that it is a file that you do not mind the quality being changed.

          In the Batch dialog you can either load your existing file list by pressing the Load TXT button, or you can check Include subdirectories and let Irfanview find all the files in the sub-folders. I do not know if there is a limit to the length of list that Irfanview can handle. I guess you will soon find out if there is.
          Attached Files

          Comment


            #6
            Thanks for the reply. I'm going to try this now... as for the JPG quality setting it in the batch settings under Options (above Advanced and in the Output area).

            Comment


              #7
              Worked perfectly, thank you. We've actually decided to not resize or rename because it leaves too much room for error. If someone has links to the images or if it needs to stay a certain size to show a client, doing this periodically for space could cause an issue. So all we want to do is find all the JPGs and in a drive and set the quality to 70% while keeping the same file. Can you tell me how to do this from the prompt? I know it'd be:
              /filelist=file.txt /jpgq=70, but how do I convert the same file via command line?

              Comment


                #8
                Hi,

                but if you repeat this batch for all the images once again, all the images you resized before will be resized again.
                What you need is a tool or a script which will generate a list with the currently unproccesed files. So saving your file.txt would be a good idea.
                I think a script would help you:
                - first scan for all jpegs and store the file list in a text file like toprocess.txt
                - look for a file like processed.txt
                - for all files in toprocess.txt check if the file and path is in processed.txt
                - if so, skip this file, and process the next
                - if not, rename the original file
                - resize it with your parameters
                - hide the original file (or delete it)
                - append the path and filename to processed.txt
                - process the next image

                But with this solution your users shouldn't be allowed to rename or move files or directories. If the do so the processed file have to be updated...

                Another idea would be to only process files which ware larger (in kb) than a given level. So if a file is shrinked and the size decreases from i.e. 2100KB to 750KB and your limit is 2000kb it won't be processed again. And files larger than 2000kb will be reprocessed until they are small engough. Therefore you will need a tool for getting / checking the file size (or use a PowerShell script). Also it would be a good idea to ignore files which a allready small in dimensions (i.e. do not process files smaller than 1000x1000 pixels).

                You also may implement a file name prefix like big_ (i.e. big_my_picture.jpg) for files which shouldn't be processed. This could be easily checked in a script. So it is possible to have some big pictures like panoramas or maybe pictures which are needed for image processing or something else...

                If you need help with a batch file, feel free to ask for it here.

                Best regards, Nils.

                Comment


                  #9
                  Originally posted by Mij View Post
                  I do not know of a way to have Irfanview put a whole set of modified files back into the same folders that they came from within a batch file........
                  For the record I now find that you can do this, because the $D placeholder (that does not work in a GUI batch) does work in a command line.

                  So you can use
                  "[path]\i_view32.exe" /filelist=[path]\jpglist.txt /resize=(75p,75p) /jpgq=70 /resample /convert=$D$N_rz.jpg
                  to create smaller copies with "_rz" added to the filenames and put in the same folder as the originals, or

                  "[path]\i_view32.exe" /filelist=[path]\jpglist.txt /resize=(75p,75p) /jpgq=70 /resample /convert=$D$N.jpg
                  to completely replace the originals with smaller versions.

                  Comment

                  Working...
                  X