Announcement

Collapse
No announcement yet.

Resize via Drag and Drop to Specific Resolution

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

    Resize via Drag and Drop to Specific Resolution

    Hi folks,

    I have a friend that uses IrfanView and he has asked me to look into a solution for a problem that he has. He has a bunch of images that he needs to resize in order to be able to upload them to a web site. The web site has a memory restriction in place which limits the maximum resolution (width x height) to a total of roughly 4,262,592 pixels. The file size can be up to 5 MB I believe but we are far short of that so that isn't a problem right now. Some of the images are portrait, some are landscape, and the aspect ratio varies from image to image. There is also the possibility that some of the images are smaller than the maximum resolution in which case no scaling would be required.

    Is there a way that I can create an icon where he can just drag and drop the image (or images) onto the icon and the images are rescaled to meet the above limitations and then saved into a new file(s)? He is not at all technically savvy so I'd prefer to give him a simple, one-step solution if possible.

    Thanks in advance.

    Glen

    #2
    Presumably the images are all the same aspect ratio, even if they are mixed orientation, so you can work out what the maximum long side should be.

    If you create a batch file to resize them, keeping the long side to 2048 pixels and maintain aspect ratio, the resulting images would be 3,145,728 — well within the limit.

    The command line option is:

    /resize_long=X - resize input image: set long side to X
    Before you post ... Edit your profile • IrfanView 4.67 • Windows 10 Home 19045.2486

    Irfan PaintIrfan View HelpIrfanPaint HelpRiot.dllMore SkinsFastStone CaptureUploads

    Comment


      #3
      I keep several batch files in a subfolder of my SendTo folder for simple conversions. That might be a good way to set it up, and there could be more than one size option handy in case it's needed. Call the folder "Resize" and give the batch files names according to the size they will reduce an image to -- 1024.bat, etc.

      Here is an example, one that I use for making a quick set of thumbnail images from a set of selected files. I copied most of it from someone else's post some time ago - LOL

      @echo off
      setlocal
      set iview="D:\grafix\irfan_view\i_view32.exe"

      :loop
      if (%1) equ () goto end
      call :doit %1
      shift
      goto loop

      rem call Irfan View vor batch processing
      :doit
      echo processing %1 ...
      %iview% %1 /resize_long=240 /aspectratio /jpgq=80 /convert=t-$N.jpg
      goto :eof

      :end
      endlocal
      exit
      It drops the converted pics in the same folder, hence the prefix t- on the new name.

      Using the SendTo eliminates desktop clutter, and prevents accidental deletion. Non-techies don't know where it is, so they can't mess it up
      Its: Belongs to "It"
      It's: Shortened form of "It is"
      ---------------------
      Lose: Fail to keep
      Loose: Not tight

      ---------------------
      Plurals do not require apostrophes

      Comment


        #4
        Thanks Matera, that works like a champ! The only addition that would be nice is if the script checked to see if the image was already smaller than the set size and would skip any files that are. That way it won't scale up any files that don't need to be. That's not a big deal though.

        Glen

        Comment


          #5
          You could do that by using /advancedbatch. You'll need to provide a i_view32.ini as well that can be used by inserting the /ini=folder switch.

          The INI would contain the necessary batch conversion information, including the element you requested, AdvNoEnlarge=1. It could also substitute for all the switches you were using, such as: /resize_long=2048 /aspectratio /jpgq=80.

          Comment


            #6
            Thanks Skippybox,

            Would I then change the line of Matera's batch that calls IrfanView to:

            %iview% %1 /advancedbatch /ini="C:\Program Files\IrfanView\batch.ini" /convert=scaled-$N.jpg
            Can I specify the name of the batch file as I have done above or does it have to be named "i_view32.ini"?

            And this is what I have in my batch.ini file:

            [Batch]
            AdvCrop=0
            AdvCropX=0
            AdvCropY=0
            AdvCropW=0
            AdvCropH=0
            AdvCropC=0
            AdvResize=1
            AdvResizeOpt=1
            AdvResizeW=0.00
            AdvResizeH=0.00
            AdvResizeL=2048.00
            AdvResizeS=0.00
            AdvResample=1
            AdvResizePerc=0
            AdvResizePercW=0
            AdvResizePercH=0
            AdvDPI=0
            AdvResizeUnit=0
            AdvResizeRatio=1
            AdvNoEnlarge=1
            AdvCanvas=0
            AdvAddText=0
            AdvUseBPP=0
            AdvBPP=0
            AdvUseFSDither=1
            AdvAutoRGB=0
            AdvHFlip=0
            AdvVFlip=0
            AdvRLeft=0
            AdvRRight=0
            AdvGray=0
            AdvInvert=0
            AdvSharpen=0
            AdvGamma=0
            AdvContrast=0
            AdvBrightness=0
            AdvSaturation=0
            AdvColR=0
            AdvColG=0
            AdvColB=0
            AdvSharpenVal=1
            AdvGammaVal=0.00
            AdvContrastVal=0
            AdvBrightnessVal=0
            AdvSaturationVal=0
            AdvColRVal=0
            AdvColGVal=0
            AdvColBVal=0
            AdvDelOrg=0
            AdvOverwrite=0
            AdvSubdirs=0
            AdvSaveOldDate=0
            AdvAllPages=1
            AdvFineR=0
            AdvFineRVal=0.00
            AdvBlur=0
            AdvBlurVal=1
            AdvMedian=0
            AdvMedianVal=3
            AdvRbg=0
            AdvBgr=0
            AdvBrg=0
            AdvGrb=0
            AdvGbr=0
            AdvAutoCrop=0
            [BatchText]
            AddText=
            TextCoord=0;0;100;100;
            Corner=0
            Orientation=0
            TranspText=1
            FontColor=65280
            TxtBgkr=16777215
            FontParam=-13|0|0|0|400|0|0|0|0|1|2|1|49|
            Font=Courier
            [JPEG]
            Save Quality=60

            Comment


              #7
              As I understand it, the INI name must remain the same (i_view32.ini) but you have to have it in a different folder -- the program is directed to that folder, rather than to an INI file with a different name.
              Its: Belongs to "It"
              It's: Shortened form of "It is"
              ---------------------
              Lose: Fail to keep
              Loose: Not tight

              ---------------------
              Plurals do not require apostrophes

              Comment

              Working...
              X