Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In a quick test I've done resizing to half size a 30k x 26k pixel painting scan [1], vips is half the time and almost a tenth of memory use.

Of course, if you're using that much memory (with imagemagick), once you begin to parallelize and do batch conversion, you fill your memory super quickly, you begin to swap, and then the conversion times go through the roof.

Image Magick

   time convert original.jpg -resize 50% im.jpg
  convert original.jpg -resize 50% im.jpg   15.99s  user 4.78s system 131% cpu 15.770 total
  avg shared (code):         0 KB
  avg unshared (data/stack): 0 KB
  total (sum):               0 KB
  max memory:                1909 MB
  page faults from disk:     485098
  other page faults:         7059
vips

   time vips resize original.jpg vips.jpg 0.5
  vips resize original.jpg vips.jpg 0.5   13.38s  user 0.15s system 195% cpu 6.910 total
  avg shared (code):         0 KB
  avg unshared (data/stack): 0 KB
  total (sum):               0 KB
  max memory:                255 MB
  page faults from disk:     1
  other page faults:         60319

1: https://commons.wikimedia.org/wiki/File:Hans_Holbein_der_J%C...


Seems like imagemagick was coredumping and my measurement wasn't correct. So I raised imagemagick memory limits and I made sure both were using the same jpeg quality and downsampling filter and:

ImageMagick

   time convert original.jpg -filter Lanczos -set option:filter:lobes 3 -resize 50% -quality 75% im.jpg
  91.43s  user 3.65s system 424% cpu 22.396 total
  avg shared (code):         0 KB
  avg unshared (data/stack): 0 KB
  total (sum):               0 KB
  max memory:                10553 MB
  page faults from disk:     0
  other page faults:         2993653
vips

   time vips resize original.jpg "vips.jpg[Q=75]" 0.5 --kernel lanczos3
  13.00s  user 0.15s system 194% cpu 6.771 total
  avg shared (code):         0 KB
  avg unshared (data/stack): 0 KB
  total (sum):               0 KB
  max memory:                255 MB
  page faults from disk:     11
  other page faults:         60951
So Imagemagick does: 40x the memory, almost 4x the time, almost 9x the CPU time.

Versions and computer:

  Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz (8 cores)
  16GB RAM
  Debian 11
  Kernel 5.18.8-xanmod1-x64v2 (software not rebuilt for x64v2 instructions)
  ImageMagick 6.9.11-60 Q16 x86_64 2021-01-25 https://imagemagick.org
  vips-8.12.2-Mon Feb 28 21:28:00 UTC 2022
Options for zsh time:

  TIMEFMT='%U  user %S system %P cpu %*E total'$'\n'\
  'avg shared (code):         %X KB'$'\n'\
  'avg unshared (data/stack): %D KB'$'\n'\
  'total (sum):               %K KB'$'\n'\
  'max memory:                %M 'MB''$'\n'\
  'page faults from disk:     %F'$'\n'\
  'other page faults:         %R'




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: