14

I have an image with a 18984x28591px resolution but I can't open it with Paint or with Pixlr Editor to reduce its size.

How can I convert or open this large image on my laptop?

enter image description here

enter image description here

  • 4
    It's not the DPI that is the trouble, it's the dimension of the file probably. It should be more than 1.5 GByte! Is that so? – TFuto Oct 17 '14 at 13:51
  • size of image is 31.3 MB (32,846,155 bytes) – Educ Oct 17 '14 at 13:55
  • 2
    Sorry, not the dimension of the file. The size in RAM. If you decode that to normal representation, that needs 18984x28591x3 bytes ~= 1.5 GByte. You will need at least this amount of RAM just to open it. And probably another 1 Gbyte for manipulating it. And 1 GByte for the OS. Something like that. – TFuto Oct 17 '14 at 14:01
  • it's my personal picture can i send it to you by google drive to reduce the size if that possible and thanks in advance – Educ Oct 17 '14 at 14:03
  • 2
    Yeah, I can try. :-) You could also try IrfanView's batch converter, it might help. – TFuto Oct 17 '14 at 14:05
29

I used ImageMagick on Ubuntu to resize those big pictures.

convert -resize 10% source.jpg dest.jpg

It took awhile, but worked with 1 GByte of RAM, the tool created a 4.7 Gbyte swap-like file for itself.

More information is on AskUbuntu.

  • 3
    You can also give it a specific resolution, e.g. convert -resize 1898x2859 ... – Michael Hampton Oct 17 '14 at 23:19
  • 2
    Also available on OSX. – o0'. Oct 18 '14 at 17:44
  • 1
    There is also a Windows version. – Tonny Oct 19 '14 at 17:54
9

Theoretically, most image formats could be downscaled progressively, without loading the entire image into memory, however I do not know any tools that really implement such feature, except for JPEG: it is special in that you can not only downscale without loading full resolution, but also downscale without decoding full resolution, thanks to the creative use of DCT (JPEG is encoded in frequency domain, which means it does not have to be decoded to the exact same resolution as the original image).

The default JPEG decoding tool (command line, libjpeg-progs package in Linux, look for djpeg.exe for Windows) will downscale huge JPEG before a "regular" application can even finish loading it:

djpeg -scale 1/8 huge_image_that_will_not_fit_in_your_ram.jpg >downscaled.ppm

I have also seen the downscale-while-loading option in some GUI application, too, but can't recall it at the moment.

Benchmark!

Comparing the memory usage and processing time of ImageMagick vs djpeg downscaling a big image (piping to cjpeg, so the resulting image is also jpg, for a fair comparison with convert)

$ display -verbose input.jpg 
input.jpg JPEG 13114x11722 13114x11722+0+0 8-bit sRGB 30.75MB 6.690u 0:06.699

$ /usr/bin/time -f "time=%E mem=%MK" bash -c "convert input.jpg -scale '12.5%' output.jpg"
time=0:10.72 mem=1225844K

$ /usr/bin/time -f "time=%E mem=%MK" bash -c "djpeg -scale 1/8 input.jpg | cjpeg > output2.jpg"
time=0:00.88 mem=1412K

1,2GB vs 1,4MB and over 10 times slower - and this was on a relatively small 13k x 11k image that could fit entirely in RAM so no swapping occured.

On the other hand, using djpeg for downscaling also has its own limitations: scaling factor choice is limited and the resampling method can't be changed.

7

You can also try using Picture Resizer on Windows (I love this tool)

You simply drag and drop the picture on this simple EXE It is especially useful if you have many pictures to convert as you can do many at a time.

All the config is done through the naming of the EXE which is brilliant IMO

I have never tried it with huge file though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.