Page 1 of 1

Help needed reducing file size of large image

Posted: 2013-11-26T01:36:15-07:00
by tomdkat
Hi! A friend of mine is having problems using ImageMagick 6.7.9-2 on a Windows 7 Home Premium edition (64-bit) system with 8GB of RAM and 2TB of internal hard drive space. The image she's working with is 16"x24" in dimension at 280 DPI. The JPEG file is about 45MB on disk. She needs to get that file down to 10MB or so, without losing image quality (if that's at all possible).

So, I asked her to run this command:

Code: Select all

convert -strip -quality 90 big-image.jpg new-image.jpg
and convert terminates with the following message:

Code: Select all

convert.exe: Insufficient memory (case 4) 'big-image.jpg' @ error/jpeg.c/JPEGErrorHandler/316.
I did some research and found the "-limit" option and the "-list resource" option. I had her run:

Code: Select all

convert -list resource
and it reported the following resource information:

File: 1536
Area: 29.452GB
Memory: 13.715GiB
Map: 27.429GiB
Disk: unlimited
Thread: 4
Time: unlimited

Of course, the above output was formatted appropriately in the command output. :)

So, I asked her to run this command:

Code: Select all

convert -strip -quality 90 -limit 1024MiB big-image.jpg new-image.jpg
with ALL of her other applications terminated (no browser windows, no PhotoShop, etc), to see what happens. At some point, I'll have her upgrade to a newer version of ImageMagick but I wanted to start this thread to see if the latest version wouldn't have the memory issues version 6.7.9-2 is having or would the version of ImageMagick not matter since the image is just plain too large?

Thanks in advance!

Peace...

Re: Help needed reducing file size of large image

Posted: 2013-11-26T01:40:00-07:00
by tomdkat
Ok, I just found out both commands above worked, once my friend closed the other applications she was running.

Code: Select all

convert -strip -quality 90 big-image.jpg new-image.jpg
generated a 9MB version of her 45MB source file and no errors were issued. So, I'm not sure if it was the memory limit option or her having all of her applications closed (or both) which caused the above command to work without error.

So, I guess I answered my own question but will still get her to upgrade ImageMagick, when she can. If there are any tips or suggestions about doing this sort of conversion, I would gladly like to read them. :)

Thanks in advance!

Peace...

Re: Help needed reducing file size of large image

Posted: 2013-11-26T02:37:13-07:00
by snibgo
On a lesser machine (4 GB) running Windows 7, I have no problems with images of that size. Your friend might check how much free space is available in %TEMP%.

When working with JPEGs, which are only 8-bit, it may be worth installing a Q8 version of IM. This uses half the memory of the more usual Q16.

Your syntax is very "old-style". For some years now it has been generally better to write operatons in the natural order: read an image, processs it, write it.

Code: Select all

convert big-image.jpg -strip -quality 90 new-image.jpg

Re: Help needed reducing file size of large image

Posted: 2013-11-26T09:32:06-07:00
by tomdkat
snibgo wrote:On a lesser machine (4 GB) running Windows 7, I have no problems with images of that size. Your friend might check how much free space is available in %TEMP%.
Do you mean the Windows environment variable "%TEMP%" or an ImageMagick variable of some kind? I'll be sure to have her run some commands to see what her Windows %TEMP% variable contains.
When working with JPEGs, which are only 8-bit, it may be worth installing a Q8 version of IM. This uses half the memory of the more usual Q16.
Thanks for this info. :) Is it possible to tell if the statically linked version of ImageMagick is installed instead of the DLL version from the command line? The "convert --version" output didn't indicate if the statically linked or the DLL version was installed.
Your syntax is very "old-style". For some years now it has been generally better to write operatons in the natural order: read an image, processs it, write it.

Code: Select all

convert big-image.jpg -strip -quality 90 new-image.jpg
Duly noted. :)

Thanks!

Peace...

Re: Help needed reducing file size of large image

Posted: 2013-11-26T14:44:59-07:00
by snibgo
I mean the Windows environment variable "%TEMP%". If there isn't enough memory for IM, it writes files in %TEMP%. If there isn't enough space, it will fail. The command

Code: Select all

dir %TEMP%
will say how much space there is. Any files in there can be deleted. (And they should be: lots of programs leave files in there, hogging disk space. I have come across an anti-virus program that writes lots of logs there, quickly filling the entire disk.)

I found that old versions of Firefox hogged memory, and I needed %TEMP% space. Current versions don't.

"convert -version" onthe first line will say "Q8" or "Q16".

If you care about static or DLL, I think the only to find out is to look at the files in IM's installation directory.