I'm using Imagemagick version 7.0.5-4 to perform image processing operations like crop, resize etc with go-graphics library. I also manage a pool of magickwand objects.
Features: Cipher DPC HDRI Modules
Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib
The read time of image to MagickWand object as magickWand.ReadImage(<url>) in png images is very high compared that of jpg images. For images of size around 22kb, reading a jpg file takes around 300ms and that of png image takes around 1-2 minutes.
Edited:
When a single request is sent to server, the read operation takes around 20ms, but when on load of 100rps, it goes till 2-4 minutes. This trend is only in png images, not in jpg.
Any ideas on what can be done different in reading png files and how it can be made performant? Its fine to reduce the quality of images to around 60%. Tried options like SetImageDepth but it made no difference.
The compression quality parameter has a different effect and meaning when dealing with PNG files from when dealing with JPEG files.
PNG compression is always lossless and the appearance is never affected by the quality. As I cannot see your images, I would suggest you either don't bother compressing since it will happen anyway, or that you use a quality of 75. If you tell me you are saving cartoons or line drawings, I might advise differently.
Please have a read here and do some experiments yourself with the tradeoff between time and filesize.
I have made you some plots to show the effect on time to compress and compressed size for different quality settings using two different kinds of images - cartoons and photos - so you can see the effect.
Here is a cartoon:
Look at how the quality setting (0-100) affects time and size with JPEG output:
Now look what happens if you use those same quality settings (0-100) when generating PNG output:
Now let's look at compressing an iPhone photo to JPEG:
And when compressing an iPhone photo to a PNG:
Hopefully you can see that using one quality setting from your config file for both PNG and JPEG and with photos and cartoons/line drawings is not ideal.
I haven't been able to find any info on this topic.
So, in terms of runtime performance which one is better: JPG or PNG? Is there any difference? Has anyone made a test?
One aspect is how much CPU is used when loading the JPG or PNG to the BitmapData. I think both get converted to raw pixel data when loaded into a BitmapData, so JPG being a compressed format would eat more CPU cycles.
The other aspect is rendering. If indeed my intuition is right there should be no difference in rendering cost.
What do you think?
Check out these excellent posts of Jackson Dunstan. I made a copy of the main conclusion related to the topic:
http://jacksondunstan.com/articles/2117:
JPEG is the fastest format to load/decompress. It’s over three times as fast as PNG
http://jacksondunstan.com/articles/2134:
Last week’s article called PNG 3x slower to load than JPEG. However, that’s only true for ARGB (full-color) PNG. Greyscale PNG is 40% quicker and indexed is takes less than half the time of ARGB PNG.
So if you don't plan to use alpha channel it's better for CPU performance to use JPG.
As a general rule of thumb when is it appropriate to make a gif interlaced, a png interlaced and a jpeg progressive?
Especially when publishing the image on the web.
JPEG: YES — use progressive scan. It makes files smaller (each pass gets its own Huffman table), and partial rendering looks quite good.
GIF: NO — it's unlikely to make the file smaller, partial rendering is poor, and it's pointless for animGIFs. It's best not to use GIF at all (yes, even for anims).
PNG: NO — it hurts compression (as data from each pass is statistically quite different). If the image is large, use high-quality JPEG or lossy PNG if possible, as these may load quicker than a pixelated preview of a large lossless PNG.
ImageOptim will automatically change progressive/interlaced formats when it makes files smaller.
Disclaimers for nitpickers:
In case of small and medium-sized images the progressive preview of each image is not going to be visible long enough for the user to appreciate it. Some browsers don't even bother rendering anything until the whole file is downloaded, so it's better to focus on saving bandwidth to get the whole page loaded ASAP.
Non-progressive JPEG is a bit more efficient when the files are tiny (small thumbnails), but then the savings are tiny, too.
iOS Safari has a higher maximum allowed image size for baseline JPEG than progressive, but the right solution there is to serve images at sizes reasonable for mobile in the first place.
My general rule of thumb: don't ever use interlacing. Interlaced formats typically occupy more space, have (slightly) more complexity and less support in decoders, and the alleged advantages for the user experience are at least debatable. Some arguments for PNG, and in general.
Some people like interlaced or "progressive" images, which load
gradually. The theory behind these formats is that the user can at
least look at a fuzzy full-size proxy for the image while all the bits
are loading. In practice, the user is forced to look at a fuzzy
full-size proxy for the image while all the bits are loading. Is it
done? Well, it looks kind of fuzzy. Oh wait, the top of the image
seems to be getting a little more detail. Maybe it is done now. It is
still kind of fuzzy, though. Maybe the photographer wasn't using a
tripod. Oh wait, it seems to be clearing up now ...
Interlaced images are slightly less efficient, but show up after shorter delay on the client side when transported over the network. IMHO they should be used when the expected download time for the image is long enough to be perceived by the user (say, above 1 second). The difference in file size is really quite small, so it's better to be too-cautious and use interlacing too much rather than too little.
In common broadband internet as of 2012, I'd just use it for every image > 100kb.
These points must be useful.
Interlacing (more generally, progressive display) is a method of displaying images on a monitor.
When to use it? Your decision should be base on these factors:
•> Non-interlaced images are smaller than interlaced images.
•> Interlaced images cause less flickering than non-interlaced ones
•> Interlaced images are much more easily view-able.
The interlace lets you see the picture before all the data has been transmitted (makes them appear faster and better-looking) and gives you the "feeling" that it is being downloaded faster.
TIP: Interlacing is not recommended for small images but is a must if
the viewer uses a slow connection
This is just a copy from Y answers i thought could help to understand.
Original answer could be find at: https://answers.yahoo.com/question/index?qid=20090211121956AAz7Xz8
Just to throw my twopenneth into the argument: Interlacing was introduced years ago when internet speeds were slow, the idea being that the image would present itself in a gradually more defined manner, still giving an overall look and feel to an image without having to wait for the entire thing to load.
Interlacing, today, is basically unnecessary and should be used based on the overall size of the image being transferred.
Progressive scans on JPEG images images do provide a more refined image while attempting to reduce the overall file size (i.e. is an actual compression mode rather than a streaming method for the bits making up the image).
PNGs use a more complex algorithm than GIF.
There is an interesting related post on webmasters
https://webmasters.stackexchange.com/questions/574/progressive-jpeg-why-do-many-web-sites-avoid-rendering-jpegs-that-way-pros
Untimately it depends on how they are going to be used.
The post suggests that there is limited - genuine - support for progressive images. And sometimes they may cause issues with plugins which don't support the progressive format.
Hope that helps.
Platform I am using is java applet, and I want to know whether I should use jpg, gif, png
jpg tends to slow down the game,
gif flickers too much
do not have much hope with png in speed
One large image is generally a bad idea for performance and memory consumption.
You want to split it in smaller chunks and load/unload them when not in use.
In java2D I always used PNG.
In other libraries it may not be important since they convert the image format to something more GPU friendly.
On the other hand, bmp is the faster thing to load (you don't need to process -i.e. decompress- the image), but it may increase your overall game size.
I am trying to put an image at a website,
the image has a transparent background and i want it to be in very good quality.
I saved it in .PNG format and in high quality but the problem is that it is really heavy and takes lots of time to load.
how can i show the picture in the same size and quality, with transparent background but with smaller file size to load quickly?
i'm talking about the image in the center of this website, with two cordless drils:
http://www.tigertools.co.il
ImageAlpha (pngquant) can substantially reduce size of transparent PNGs.
Whether it reduces quality depends on the image. Usually loss is not noticeable.
Dithering to 256 color (optimized palette) and saving as PNG seems to bring down file size to 96KB. This is using IrfanView.
However, not all dithering software handles the semi-opaque pixels near the object boundary correctly.
With regard to the quality loss, it's better to do a double-blind test to get unbiased subjective opinion. Keep in mind that the reduced website loading time will make users happier, which may compensate the hypothetical slight loss in quality.