15
\$\begingroup\$

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

\$\endgroup\$
6
  • 4
    \$\begingroup\$ 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? \$\endgroup\$
    – TFuto
    Commented Oct 17, 2014 at 13:51
  • \$\begingroup\$ size of image is 31.3 MB (32,846,155 bytes) \$\endgroup\$
    – Educ
    Commented Oct 17, 2014 at 13:55
  • 2
    \$\begingroup\$ 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. \$\endgroup\$
    – TFuto
    Commented Oct 17, 2014 at 14:01
  • \$\begingroup\$ 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 \$\endgroup\$
    – Educ
    Commented Oct 17, 2014 at 14:03
  • 2
    \$\begingroup\$ Yeah, I can try. :-) You could also try IrfanView's batch converter, it might help. \$\endgroup\$
    – TFuto
    Commented Oct 17, 2014 at 14:05

3 Answers 3

30
\$\begingroup\$

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.

\$\endgroup\$
3
  • 3
    \$\begingroup\$ You can also give it a specific resolution, e.g. convert -resize 1898x2859 ... \$\endgroup\$ Commented Oct 17, 2014 at 23:19
  • 2
    \$\begingroup\$ Also available on OSX. \$\endgroup\$
    – o0'.
    Commented Oct 18, 2014 at 17:44
  • 1
    \$\begingroup\$ There is also a Windows version. \$\endgroup\$
    – Tonny
    Commented Oct 19, 2014 at 17:54
10
\$\begingroup\$

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.

\$\endgroup\$
0
8
\$\begingroup\$

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.

\$\endgroup\$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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