Is there any easy way to downsize an image to a target filesize, rather than reducing edges by %?

I’m the newsletter editor for an association to which I belong, and I need to process many image files for each issue. I compose and lay out each issue using MS Word, print it to PDF, and send the latter out to the members. I need each image to be about 250 or 300K in size; any smaller and it becomes too blurry even for a little association newsletter like this; any bigger and problems may arise somewhere down the line, either with the final formatting or when the members read the email and download their copies.

I’m not all that experienced with graphics tools yet, but with all the ones I’ve tried the resizing function is based on reducing the perimeter by a desired percentage, or to a desired resolution or pixel size. So for each image I have to calculate as follows. Naturally I use the calculator in my phone for this, but it’s still a bore:

[ol]
[li]calculate desired-filesize/original-filesize to obtain the reduction needed[/li][li]Take the square root of the last result to estimate by how many percent I need to reduce edge lengths[/li][/ol]

The trouble is, the original sizes of the images are usually all different, so the calculation really does have to be redone every single time. I’m wondering if there’s any application or tool with which I specify the desired target filesize, and the tool could do all that work for me?

Take a look at IrfanView. You can resize by specific horizontal or vertical dimension or percentage. You can also choose “quality” which impacts resolution. It’s a universal viewer as well and can do some editing too.

GaryM

I’d love to help, and I work a lot with both image files and video files, but I’m a little confused.

Are you saving the image files as JPEGs and then inserting them? A 1600x1200 JPEG, using reasonably good compression, should be much less than 300KB, and more than adequate for printing in a newsletter. I think you might be confusing final image file size with image quality and the two do not necessarily correspond with each other.

I’m also thinking you may want to look at your configuration for Word and how you are exporting to PDF. Word does a notoriously bad job of saving to PDF without a lot of tweaking. I always print to a PDF converter instead of saving directly from Word to a PDF.

And I’ll second IrfanView. Once you understand how to use the settings, it does a great job with many common image processing tasks.

…and a third with a link

Do you have any control over the input image format? Meaning, is it PNG, TIFF, JPEG2000, JPEG? Are the originals really all about the same size and content (a busy ultra HD color image will not compress as much as a postage-stamp-sized black square)?

Anyway, for photo-type images what you want to do is use JPEG2000 and specify an exact compression ratio.

ETA don’t use plain JPEG as you will not have precise control over the file size.

I also second ZonexandScout’s advice to use a utility like Adobe Distiller to create the PDF file; in Windows you should see “Adobe PDF” as a print option if it is installed.

(Ghostscript can be used if you do not have the Acrobat software installed.)

If you’re doing bulk, I have used a freebie utility called “Fotosizer” which you can use to resize a number of photos at once.

Same deal - select “keep aspect ratio” and set one of the dimensions in pixels (or percent, take your pick)

Simple word of caution - always keep the originals, write any modified photos to a different filename.

Words to live by right here!

GaryM

That’s how I do it. I am aware that Word allows you to save a .docx file as a .pdf, but that the resulting file comes out much larger than when it’s done the other way, apart from whatever other issues may be introduced by saving a document as an Acrobat file.

The problem is that when you want to reduce the image size, it’s really an area problem. Edge based scaling tools work linearly.

Suppose I have a square image of size 1Mb, and I want to reduce it to 250Kb. So I can just reduce the height and width by three quarters, right? Of course not. If I want the new version to be one-fourth the size of the original, I have to reduce the edges by just half. Of course, the files that I’m working with don’t all start out with some nice, even, and consistent filesize like 10M. Not only does the camera optimize each photo slightly differently, but I’ve also usually done some cropping and other post processing before I even get to where I’m ready to reduce the sizes. So, every photo means repeating the calculations. Given that the actual photos aren’t square but rectangular, I realize that using the square root doesn’t give me the exact figure I want, but it’s a useful method of estimation.

In the OP I asked about the possibility of a tool where I could simply specify that I want the resulting file to be 350Kb or whatever, but it would be almost as good if there was a way of specifying the desired size reduction in percentage or decimal form, but with respect to the area rather than the edges.

Do you really want to change the image size as in number of pixels by rescaling it, reduce the file size by compressing it more aggressively, or both?

If you start with an uncompressed file and encode it using JPEG2000 with 16:1 compression, the resulting file will be a quarter that of if you use 4:1 compression, without changing the image dimensions or resolution. The compression ratio applies to the raw file which has a known number of bits per pixel. That sounds like it satisfies your “almost as good” criterion; the only question is whether any encoding library lets you specify the output size directly rather than a compression ratio.

I haven’t tested them all; eg this link claims you can specify the bitrate on the command line.

:smack: bitrate is tantamount to compression ratio, sorry. All libraries I know let you specify the ratio.

Inserting JPEGs into Word does something peculiar in Word to the Word filesize, IME. Try saving the image as Windows Media Format (.wmf), and then insert it into Word.

You may also need to resize according to the page dimensions, i.e., in inches/cm rather than pixels. But still try .wmf.

Whatever Word does to JPEGs, it results in massive files. I’ve converted (for personal, not professional, use) older PDFs with illustrations into EPUBs, and ended up with 100 MB RTF files. If I open the RTF in Atlantis and re-save it as an RTF, the file size will be below 10 MB.

If you’ve got a Mac handy, you can pretty much do this with the built in Preview app.

Open the image in Preview, then File > Export… > Format: JPEG. Then as you slide the Quality slider from Best to Least, it will dynamically give you an estimate of the file size of the resulting exported file.

If the Least quality is still too big, go to Tools > Adjust Size > Resolution and lower the resolution. It will then estimate what the resulting file size will be depending on the new resolution. Keep lowering the resolution until you reach your target file size.

So you can’t plug in say 285 KB as a precise target, but even with a large image you should be able to get very close.

If you have access to Adobe Lightroom, it lets you do that in the export settings. Under file settings, if you select JPEG as your image format, there is a checkbox “Limit File Size To: ____ K”.

ETA: I should add that this parameter determines JPEG quality. It does not resize the image based on those constraints. The resize amount you have to plug in manually. Presumably, though, you have at least a minimum target resolution in mind.

ImageMagick can do it. It started life as a Linux command line too, but it’s available for Windows and Mac with a front-end.

You can also search for “optimize images for web” which is the term for what you want. I have a hosted website that has this option available at the click of a button. There are probably online tools or simple programs just for doing it.

That should be command line tool