I want to make image quality check. Maybe calculate some index of that quality.
For example, lets say, user A uploads something like http://www.hyperconectados.com/wp-content/uploads/2014/03/Selfie.jpg
and user B uploads something like http://www.privatewifi.com/wp-content/uploads/2014/02/selfie.jpg
It's obvious, that B photo is professional and in good quality. There's another thing, that it's not good to use image size and weight(?) because B image could be resized, photoshoped or something else (lost some image data).
Is there a way to detect that difference? :) Any ideas?
I am still thinking of further indicators, but for the moment...
IPTC Profile and/or Copyright
I would say that most professional photographers wouldn't let an image out the door without an IPTC profile and Copyright notice.
You can find that with ImageMagick like this:
identify -verbose image.jpg | grep -i profile
and your second image comes up with
Profile-8bim: 104 bytes
Profile-iptc: 92 bytes
You can actually read the profile like this:
convert b.jpg 8BIMTEXT:-
8BIM#1028="IPTC"
2#103#Original Transmission Reference="53616c7465645f5fb085443d8e4c5898afc929fa83c3cc27d7bf6da5d5f63efdf47888b1a19ac93e"
2#0="�"
or
convert b.jpg IPTCTEXT:-
2#103#Original Transmission Reference="53616c7465645f5fb085443d8e4c5898afc929fa83c3cc27d7bf6da5d5f63efdf47888b1a19ac93e"
2#0="�"
Resolution (dpi)
Another discriminant would probably be the resolution. Most mobile phones, and amateurs, and web-based images have a resolution of 72dpi or 96dpi. Most professional photographers would tend to favour 300dpi for high quality printing, so I would probably threshold at around 150dpi. You can get the resolution like this:
identify -verbose image.jpg | grep -i resolution
or faster and more succinctly
identify -format %x image.jpg
300
I note your first image has 72dpi and the second one has 300dpi.
Scope for enhancement
Another idea, which I am thinking about is what happens if you try to enhance the image digitally, and then see the differences between the enhanced image and the original and try to deduce something from that. Presumably, a professionally edited image will not be as susceptible to enhancement on the basis it should already be "good". So, let's say we choose ImageMagick's -enhance
option, and enhance your two images and then look at the differences between the original and the enhanced images. I am going to switch to lossless PNG
format to avoid JPEG
quantisation effects.
# Make PNG
convert a.jpg a.png
# Enhance "a.png" and save as "ae.png"
convert a.png -enhance ae.png
# Compare "a.png" with "ae.png"
compare -metric rmse a.png ae.png -format "%[distortion]" resa.png
360.479 (0.00550055)0.00550055
Now do same procedure for second, professional image:
# Make a comparably sized PNG
convert b.jpg -resize 1200x1200 b.png
convert b.png -enhance be.png
compare -metric rmse b.png be.png -format "%[distortion]" resb.png
421.08 (0.00642527)0.00642527
I am still thinking about this...
Imagemagick to read the quality
$ identify -verbose tornado_ok.jpg | grep Quality
For more info on identify
Got the info from this question