I am trying to understand the relation between image pixels, their size, resolution and how changing the resolutions of an image results in the same image size but slight amount of blurriness. I referred to this links but some doubts still remain:
1) So, what is the "commonly" accepted definition of "resolution"?
2) How(and Why) does changing the resolution of an image (say, a Desktop wallpaper) result in the same image size but a slight amount of blurriness? In this case, what definition of "resolution", "pixels" and "image size" are we talking about?
Thanks in advance!
The image that is displayed on the screen is composed of thousands (or millions) of small dots; these are called pixels.
The number of pixels that can be displayed on the screen is referred to as the resolution of the image.
Image resolution is the detail an image holds.
As the resolution goes up, the image becomes more clear. It becomes
sharper, more defined, and more detailed as well.
In addition to image size, the quality of the image can also be manipulated. Here we use the word "compression". An uncompressed image is saved in a file format that doesn't compress the pixels in the image at all. Formats such as BMP or TIF files do not compress the image.
If you want to reduce the "file size" (number of megabytes required to save the image), you can choose to store your image as a JPG file and choose the amount of compression you want before saving the image.
These terms are explained in a video
Put in simple words, resolution is simply the number of pixels(picture cells) contained in a horizontal/vertical axis. The more the pixels arranged in an axis, better the image. The formal definition can be easily availed on the web.
Changing the resolution simply means changing the number of pixels in the image.Higher resolution implies more pixels hence a more detailed image. Reducing the resolution of an image decreases the image size following either lossy or lossless compression algorithms. This further reduces the amount of information in the image leading to the blurriness or the jagged edges.Image size varies according to the degree of compression only. 'Pixels' and 'Resolution' remain what they had been explained.
Related
I have a photo with a size and pixel diemensions as shown below:
I opened and saved it using Matlab, and the size of this photo becomes much smaller, and also a smaller dpi value. But the diemension is still the same.
Then I converted the two to .bmp format, and the bmp images are in the same size! Does the dpi value correlate to image size, or there are other reasons behind?
When an image is described as 7952× 5304 pixels, then the dpi value is of no consequence. It means nothing.
Where the dpi value comes in, is in describing how large the image will be printed.
You can always resize the image to the dimensions you want with imresize.
I used Microsoft Paint to create a 15248 x 6552 solid color picture. I saved it as both .png and .jpg and was expecting the .jpg to be smaller than .png, but it was not.
The .jpg file is 1.49MB, while the .png is 391KB. Shouldnt jpeg being a lossy compression be technically smaller in size?
I read somewhere that .png is better for solid colors etc, so I downloaded a picture form the web (not a solid color) and used paint to save it in both formats. This time the jpeg was smaller than png. Is it solely due to the gradient of colors? if so then why?
Even if the picture is a solid color should jpg encodng be able to compress it even better?
It's to be expected that PNG performs better than JPEG in this scenario.
As pointed out in other answer, PNG does a per-line pixel prediction, followed by ZLIB compression. If the image has a single colour, the prediction will produce a constant zero value for all the pixels, except for the start of each row. Hence the compression will be very effective. I'd bet that if the image were "landscape" (6552 x 15248 instead of 15248 x 6552) the compression would be even a little better.
JPEG compression, instead, divides the image in blocks of 8x8 pixels, and for each one it attempts to quantize finely the low frequency components and coarsely the high frequency components. This works nicely for "natural" (photographic or rendered) images, but no so nicely for images with few colors (or a single one!).
See some comparisons here.
Not necessarily.
PNG is a prediction-based algorithm, which means that it tries to deduct the value of one pixel based on previously coded pixels. I bet the prediction is really accurate for a solid image, thence the very good results.
JPEG accepts different "quality levels" which determine the size of your compressed file. The size differences between your experiment and the web version are likely due to that (unless you're downloading a different image, of course!).
Note that JPEG may introduce some image artifacts because it is a lossy algorithm, while PNG will recover the exact input image for you.
I've found for the same picture that if you save as PNG 1st then JPG the PNG will be smaller and if saved as JPG 1st it will be smaller than the PNG saved afterwards
I'm making a website with a single image as a background (with different backgrounds for subpages). So far I have established that the image should be about 1920x1080, possibly with 1.77:1 aspect ratio and a jpg for PCs. Now I want to reduce the image file size without losing quality.
1) First my problem. I have encountered the most bizarre thing in photoshop. When I upload an image 4272x2848 that weights 521 KB into photoshop and save it without changing anything, its size increases to... 1,52 MB ??? After I cut down the size to ~1920x1080 the size is still ~800 KB. Also the image before uploading has 96 DPI, after it is uploaded it changes to 72 DPI. (What sorcery is this?)
2) What is an acceptable image file size with that resolution?
3) Should I use save for web? This increases the size or reduces the quality from what I have experimented.
4) I found this image size reducer website: https://kraken.io/web-interface It reduces the size and I think the image quality does not change.
5) http://www.filedropper.com/pancakes - the image from question #1. (The image will probably be changed in the near future so this one is more of a case study).
Thanks!
JPEG being lossy, every time you load, then save, a separate JPEG algorithm is applied again. I believe the default for Photoshop is High quality, which an 8 on their dialog. So if you have an original JPEG that was originally saved as a low or medium quality (say a 4-6 on the Photoshop dialog), if you then open that in Photoshop, and go with the default "High/8" quality save, then the JPEG algorithm is applied on the perceptual image, meaning you saved a lower quality perceptual image at a higher quality algorithm's amount of data.
This is a major reason that I've moved away from JPEG. If JPEG is required I always try to start with either a RAW, BMP, TIFF, or PNG image, and then save off a JPEG version from that, then if I need to make any changes I go back to the full "original" [lossless] format, make the changes then save the JPEG again. I try to never edit an image that is already saved as JPEG, because you're always going to lose a small amount of quality (mostly the JPEG algorithm is good enough that the loss of quality isn't perceptual, but the file size can change none-the-less).
Just wondering:
I'm trying to set up an adaptive image handler in Coldfusion8, which resizes images for smaller screensizes.
I have it working allright and am currently playing around with the different resize options found here
What I notice is no matter what method I'm using, they all take time, reduce the image quality and not really reduce the image size, so for example:
IMG 1 IMG 2
Original 23K 900x360px 53K 900x360px
Blackman 22k 320x128px 52K 320x128px
highPerformance 21K 320x128px 32K 320x128px
nearest 25K " 38K "
The idea was to resize images for smaller displays. Right now I'm not really reducing anything, I'm only drainging the processor for resizing and output blurry images and the same file size.
Question:
Why should I bother resizing then? I might as well send the original file which #900x360px #23K. At least that images will be sharp vs. a resized blurry image with 320x1280px. Is there a way to make resizing images in Coldfusion worthwhile in terms of file size and/or image quality?
Thanks for inputs!Cldfu
I think what you fiddle with are quality/speed of the resize algorithm, not compression.
To compress with better file size, set the JPEG compression quality using the quality attribute (default to 0.75)
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7945.html
If cfimage doesn't satisfy your needs, use imagemagick
I have some JPEG images that I need scale down to about 80% of original size. Original image dimension are about 700px × 1000px. Images contain some computer generated text and possibly some graphics (similar to what you would find in corporate word documents).
How to scale image so that the text is as legible as possible? Currently we are scaling the imaeg down using bicubic interpolation, but that makes the text blurry and foggy.
Two options:
Use a different resampling algorithm. Lanczos gives you a much less blurrier result.
You ight use an advances JPEG library that resamples the 8x8 blocks to 6x6 pixels.
If you are not set on exactly 80% you can try getting and building djpeg from http://www.ijg.org/ as it can decompress your jpeg to 6/8ths (75%) or 7/8ths (87.5%) size and the text quality will still be pretty good:
Original
7/8
3/4
(SO decided to scale the images when showing them inline)
There may be a scaling algorithm out there that works similarly, but this is an easy off the shelf solution.
There is always a loss involved in scaling down, but it again depends of your trade offs.
Blurring and artifact generation is normal for jpeg images, so its recommended that you generate images is the correct size the first time.
Lanczos is a fine solution, but you have your trade offs
If its just the text and you are concerned about it, you could try dilation filter over the resampled image. This would correct some blurriness but may also affects the graphics. If you can live with it, its good. Alternatively if you can identify the areas of text, you can apply dilation just over those areas.