Scale image to specific file size - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP) +--- Forum: General questions (https://www.gimp-forum.net/Forum-General-questions) +--- Thread: Scale image to specific file size (/Thread-Scale-image-to-specific-file-size) |
Scale image to specific file size - MattRothschild - 09-15-2017 Hi all - Thanks for the great resource and information. One thing I am trying to work out is how I can have GIMP scale images to a specific size so that they are compatible with the www site I am developing. I am taking images with a Canon DSLR camera and they come into GIMP at 3MB+ and I want to scale them down to 800 x 800 and 72KB max. I have tried the Batch GIMP Plug in for scale and that is working for the 800 x 800 but the files end up as different file sizes (between 50-150K). Is anyone aware of a batch plug in I can use that will produce both 800 x 800 and also file sizes maxed to 72KB? Many thanks for the help. RE: Scale image to specific file size - Ofnuts - 09-15-2017 It's hard to predict the size of a JPEG. It depends on the image contents (a blurry image compresses better than a sharp one). IMHO your best bet is to use a script based on ImageMagick's convert that produces progressively smaller sizes by reducing the JPEG quality, and stops once the size is below your limit. RE: Scale image to specific file size - rich2005 - 09-15-2017 ImageMagick is probably the best bet, but if you want a GUI try XnConvert Quote:I am taking images with a Canon DSLR camera and they come into GIMP at 3MB+ and I want to scale them down to 800 x 800 and 72KB max. Using BIMP? One factor is BIMP will not remove any Metadata which might amount to 30 or 40 KB of the file size. For a GUI application I would use XnConvert https://www.xnview.com/en/xnconvert A few screen shots to get you started Add as many files as you need, you can see these about the 3 - 3.5 MB file size and tagged as having exif data https://i.imgur.com/0IQIvkj.jpg Add an action, resize to 800x800 but keep aspect ratio https://i.imgur.com/6xDDGrq.jpg Then in the output settings - untick all the keep/preserve options quality is going to be about 50, ticking progresive saves a couple of KB and sub-sampling to lowest. https://i.imgur.com/RsGxkyK.jpg That gets the original 3.7 / 3.2 MB 3000x2300pix files down to 63 / 64 KB 800x600 pix Not much benefit with jpeg going below 50 quality. If you can not get a small enough file size, you need a smaller final image size. RE: Scale image to specific file size - rich2005 - 09-15-2017 If you want to try ImageMagick (IM) Digging out my IM notes. One way is using the mogrify command (In Windows now magick mogrify) mogrify can be dangerous, it overwrites files in place. Always work with copies. Keep the originals safe. Two stages, first remove any metadata Code: magick mogrify -strip *.jpg In linux the terminal looks like this (no magick needed in linux): https://i.imgur.com/ehAfTrJ.jpg Next resize to maximum 800 pix but keeping aspect ratio and define a file size around 70 KB Code: magick mogrify -resize "800>" -define jpeg:extent=70kb *.jpg screenshot: https://i.imgur.com/N2IBT54.jpg Worth a try, best place to ask is IM forum https://www.imagemagick.org/discourse-server/ users section |