I need to resize (and sharpen and rotate) some images on demand to create various resolutions. I have a small development computer (Ivy Celeron @ 2.6GHz). My little test picture takes in the 64 Megapixel (resolution) and 4Megapixel versions of a cute little kitten picture and reduce both versions to 750 x 400 (target size).
One versions use JavaIO + ImgScalr and the other one uses Graphics Magick + im4java.
The 4 Megapixel version takes 270ms per Picture using native JavaIO + scalr and 360ms with GraphicsMagick. A 64 Megapixel picture takes 3100ms to resize using JavaIO + scalr and 4300ms using GraphicsMagick.
Am I missing something here. Most of the time is spend opening and reading the file and saving the result but also scaling is much slower using GraphicsMagick. I understand that those are related to the user of some more advanced algorithms but in the end the result looks really good in both versions but also I did not thought that my 2013 computer is not able to process at least 1000 images per second but makes barely 3 to .3 pictures a second.
So the question goes, what do I do wrong? What are your measures of resizing images? Do I really need a whole server for processing a lets say 10 pictures a second?
** Update **:
Doing some math: 64M / 3seconds = 20M/sec / 2.6GHz = 10Mio/GHz = 1pixel/100 Clock-Cycles. So it seams to be almost ok though. For 4M we have: 3M /.3sec = 9M/sec = 1pix/200 cycles.
So here goes an updated question: Is there a format that might sacrefies Memory in order to fast load an image? The best would be raw/bitmap taking maybe one sec to load since SSD is slow (64M*3 = 192MB, 4M*3=12MB). But is there something in between? I doubt using JPeg with poorer quality will be the deal since it seams to not speed up decompression.
Maybe a zipped bitmap with separated color channels? (Do not laugh!:-)). Maybe some other. How fast was ZIP?
Also an Idea is to provide several resolutions (one time penalty) and use the nearest resolution version available. A 1M resolution would be 4M in memory and should result in 12 Picture conversions per second (argh). I was prepared to see at least a 1000/sec but the leap in computer power seams not to be that big within the last 10 years. I will try and start this in parallel using two or more worker threads. Lets see if this doubles up.