12

I've got about 700+ png images. I need to resize and save them. However I also need their transparency to be intact.

I tried Irfanview, but that didn't work. GIMP works, but I can't find a batch saving option. I'm not going to manually resize and save 700+ images. That's too tedious.

Is there any applications out there that do the job I need ?

5
  • Have you tried ImageMagick?
    – slhck
    Mar 19, 2013 at 8:12
  • No, but isn't that for servers? Mar 19, 2013 at 9:54
  • 1
    What do you mean, for servers? It's a command-line software that can be run on any operating system.
    – slhck
    Mar 19, 2013 at 9:57
  • Yea, no. Command-line isn't my strength. I need something with a handy GUI. Mar 19, 2013 at 10:38
  • @DonSalva you can do it within 2 lines of cmd by using ffmpeg, even without strength
    – Jet
    Apr 29, 2014 at 14:26

6 Answers 6

11

Sorry, you are going to have to use the command line. I really really doubt that you can find a GUI program to deal with this.

You have not specified which OS you are using. On Linux, the following command will resize all .png files in the current directory. Note that it will overwrite the original images:

##  bash (Linux, OSX):
for i in *png; do convert "$i" -resize 32x32 "$i"; done
##  on Windows:
for %i in (*png); do convert %i -resize 32x32 %i; done

Note that, for the Windows line, if you are using it in a script rather than on the command-line, you need to use %%i rather than %i.


Another option would be GIMP scripting. This script will resize your image (source):

(define (batch-resize pattern width height)
(let* ((filelist (cadr (file-glob pattern 1))))
(while (not (null? filelist))
(let* ((filename (car filelist))
(image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
(gimp-image-scale-full image width height INTERPOLATION-CUBIC)
(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
(gimp-image-delete image))
(set! filelist (cdr filelist)))))

Save it as batch_resize.scm in GIMP's scripts directory, then run it as follows:

gimp -i -b '(batch-resize "*.JPG" 604 453)' -b '(gimp-quit 0)'

UPDATE:

I just stumbled upon this post that suggests that the GIMP plugin David’s Batch Processor should do exactly what you want. The article is about Linux but there is a link to a windows version on the plugin's page.

5
  • My bad, I always forgot the OS. It's Win7 64bit. Mar 19, 2013 at 21:53
  • Well, ImageMagick has a windows version and you should (somehow) be able to use the GIMP script in windows as well.
    – terdon
    Mar 19, 2013 at 21:55
  • @DonSalva see updated answer.
    – terdon
    Mar 19, 2013 at 22:08
  • ImageMagick is an awesome tool for this type of work. Learn how to use it and you'll love it forever! Mar 19, 2013 at 22:15
  • All thanks to @evilsoup for adding the windows command line.
    – terdon
    Mar 20, 2013 at 0:12
5

I think ImBatch tool can help you with your task. Works fine with Win7 x64 for me. It is free.

1
  • Great tool, much more flexible than IrfanView and supports png with alpha - thanks! Apr 3, 2013 at 23:20
4

XNConvert has a simple and intuitive GUI for those tasks.

XnConvert is a powerful and free cross-platform batch image processor, allowing you to combine over 80 actions. Compatible with 500 formats. It uses the batch processing module of XnViewMP

  • batch processing
  • preservs transparency (tested with a transparent PNG)
  • automatic or predefined resize
  • no installation necessary

enter image description here

4
  • I tried this and it didn't maintain transparency (Mac version). Does it make what kind of resampling is used (I used Lanczos as you did).
    – niico
    Sep 2, 2014 at 22:51
  • Worked this out myself - using Bilinear Resampling does it. You can see in the 'After' window how it's going to look - if the transparent area is black you know it's not going to work.
    – niico
    Sep 2, 2014 at 23:07
  • @niico I now tried 3 different resample methods, Lanczos too. They all produce transparent images. Maybe the MAC version works in a different way
    – nixda
    Sep 2, 2014 at 23:11
  • I tried this on PC and Mac - identical on both. Further - I now notice the resampling I did is jaggy as hell and unusable.
    – niico
    Sep 4, 2014 at 3:58
2

By default, using FFMpeg is the shortest way :)
Download it here, put it in the folder with your files, open command line, go to your folder (with cd) and write there:

mkdir Resized
for %f in (*.png) do ffmpeg -i "%~nxf" -s 32x32 "Resized\%~nxf"

and change 32x32 with your size. It will resize your PNGs and put it on Resized folder.
This will do the work without batch file. However if you want to put this in bat file, write %% in place of %.

Hope it will help you.

0

I haven't tried ImBatch or XNConvert, that others mentioned here, but here are a couple of more suggestions for you:

  • pngquant (a command-line tool. Myself, I used the Windows GUI PNGoo included on the page)
  • Color quantizer (lots of possibilities to tweak settings to use various dithering algorithms etc. I never got it to work as well as PNGoo/pngquant, but that might be because of my limited knowledge).
  • TinyPNG.com (the free web service has a limit of 20 files, each smaller than 5MB)
0

I had this same issue many times, and I've had Photoshop installed for most of those times. So I put this script together using a few inspirations of other's code.

https://gist.github.com/pixelbacon/7754cba64125b0240504

Usage

  • Install Photoshop CC or newer version.
  • Open the script in Photoshop.
  • A dialog will ask you to choose a source folder.
  • A dialog will ask you to choose a destination folder.
  • Another dialog will ask you the maximum width & height.
  • Another dialog will ask you for ideal width, then ideal height.
  • Wait while the script will open all the PSD or AI files you have in your source folder and save them out as transparent PNG-24.
  • A dialog will let you know when it is done.

References

There were more than 2 links to reference, my current reputation does not allow me to post any more. See the original script as references are documented.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .