Find poor images by "pixel per byte"
Moderators: white, Hacker, petermad, Stefan2
Find poor images by "pixel per byte"
I'm currently trying to figure out how to get a column with information on the apparant quality of images. I'm trying to make a rough guesstimate on how aggressively an image is compressed combined with how much unique information can be found inside.
Images that are big in dimensions but small in filesize are considered not good; images that are big in filesize, but small in dimensions are considered extremely good. These will be the two extremes of the spectrum, i.e. from solid white png to losslessly compressed photographs. I'd like to see a number that identifies something between these two extremes.
My first guess on how to do that, is rather simple: pixelwidth*pixelheight/filesize. But I can't find a way to do that, not even using this excellent plugin. I kind of assumed the custom columns allowed for simple expressions, but it seems not.
First question: any quick way of getting the result of width*height/size in a custom column?
Second question: any better ways of assessing image quality? (of course, disregarding JPEG compression - that is mostly useless)
Thanks
Images that are big in dimensions but small in filesize are considered not good; images that are big in filesize, but small in dimensions are considered extremely good. These will be the two extremes of the spectrum, i.e. from solid white png to losslessly compressed photographs. I'd like to see a number that identifies something between these two extremes.
My first guess on how to do that, is rather simple: pixelwidth*pixelheight/filesize. But I can't find a way to do that, not even using this excellent plugin. I kind of assumed the custom columns allowed for simple expressions, but it seems not.
First question: any quick way of getting the result of width*height/size in a custom column?
Second question: any better ways of assessing image quality? (of course, disregarding JPEG compression - that is mostly useless)
Thanks
Hi Thany,
It also depends on the type of images you have in a folder. If you have a mixture of photos and other type of pictures, like banners (e.g. you ripped a whole website) then you can use ratio (width/height) to determine if the picture is worthwhile. Normally a (standard) photo never exceeds the 1.6 or goes under 0.6, while banners are often above or under those values. Thumbnails of photos is hard, most of time only file size and picture dimensions together are decisive.
I'm also using Wdx4i to get mentioned values.
Regards, EricB
It also depends on the type of images you have in a folder. If you have a mixture of photos and other type of pictures, like banners (e.g. you ripped a whole website) then you can use ratio (width/height) to determine if the picture is worthwhile. Normally a (standard) photo never exceeds the 1.6 or goes under 0.6, while banners are often above or under those values. Thumbnails of photos is hard, most of time only file size and picture dimensions together are decisive.
I'm also using Wdx4i to get mentioned values.
Regards, EricB
Thanks for the thought.
Aspect ratio I've already filtered out, and I decided to keep anything between 0.4 and 2.0, so a bite more generous
I'm still really looking for this guesstimate of photographic quality, i.e. the number of pixels that go in a byte (or kilobyte). More "pixels per byte" denotes a lower quality, i.e. higher jpeg compression, less unique information, or multiple lossy saves.
I know this is not a solid way of filtering out low qualities, but a guesstimate is good enough for my purposes.
Aspect ratio I've already filtered out, and I decided to keep anything between 0.4 and 2.0, so a bite more generous
I'm still really looking for this guesstimate of photographic quality, i.e. the number of pixels that go in a byte (or kilobyte). More "pixels per byte" denotes a lower quality, i.e. higher jpeg compression, less unique information, or multiple lossy saves.
I know this is not a solid way of filtering out low qualities, but a guesstimate is good enough for my purposes.
Have a look at Identify from ImageMagick.
It tells you the Jpeg quality percentage among other things.
You could write that into a descript.ion file with a batch:
After that enable comments in TC (Ctrl+Shift+F2)
It tells you the Jpeg quality percentage among other things.
You could write that into a descript.ion file with a batch:
Code: Select all
for %%i in (*.jpg) do identify.exe -format "%%f %%C %%Q" %%i >>descript.ion
Thanks, but like I said, it's not the JPEG quality I'm looking for. I'm looking for visual quality, not compression ratio. For jpeg (and jpeg alone) the quality setting can be 100% and still produce a very bad quality image (i.e. many pixels per byte) and it was re-saved from an original image that had quality=10%.
Also, your solution doesn't cover PNG, GIF and other lossless formats. PNG can also achieve quality that for my purposes would be considered "bad", when for example it's a solid white image (which will produce many pixels per byte). A much more complex drawing that therefor has much more unique pieces of information, will produce a larger file (less pixels per byte) and be considered "good" in y scenario.
So I think I really need something like "number of pixels per byte"
Also, your solution doesn't cover PNG, GIF and other lossless formats. PNG can also achieve quality that for my purposes would be considered "bad", when for example it's a solid white image (which will produce many pixels per byte). A much more complex drawing that therefor has much more unique pieces of information, will produce a larger file (less pixels per byte) and be considered "good" in y scenario.
So I think I really need something like "number of pixels per byte"
The solution provided using identify goes in the right direction !Thany wrote:
So I think I really need something like "number of pixels per byte"
Code: Select all
@REM calculate Pixel per byte
@echo off
del descript.ion
for %%i in (*.jpg *.png *.gif ) do identify.exe -format "%%f %%[fx: %%~zi / ( w * h )]" %%i >>descript.ion
fx:.... allow identify to do calculations
w * h is the number of pixel
..... give a look to batch scipting and imagemagick documentation.
With this script you calculate what you want. In user column, you can add "Pixel per Byte" as tc.comment and filter, sort,....
You can also take into account the number of colors in the image and about subjective image quality you can also take into account medium size of connected pixels (not as easy to calculate without real image processing programming)...
You should try to understand the expression if you wan t to adapt it.Thany wrote:Oh wow, well I had never know it's that powerful. I don't quite understand the expression, but if you say it works, I'll believe it
I'll test it out soon and let you know
First install imagemagick bundle and verify that convert, mogrify and identify command lines are in the path. (This is one of the most powerful image processing set of command line tools)
Create a batch script used to initialize descript.ion files in each image folder. (if you already set comment using descript.ion file you must save it first or you will loose all using the script). For more info on batch scripting, you get a lot of info here
You can set a em_command targeting your script and use it as a hotkey or a button
Download ImageMagic
Read documentation of identify, -format escapes and %[fx:....
Oh yes I see it now. those parts are just standard batch derived variables. I guess I forgot about the filesize one, because I've never had to use it.
As for the identify.exe trick, I promised to check back. It works
filsize/pixels is actually better than pixels/filsize, because it gives a number lower than 1 (usually, in my case) which doesn't absolutely require numeric sorting.
It does what I need for now, but whenever I need something more, I'll know where to look. Thanks!
As for the identify.exe trick, I promised to check back. It works
filsize/pixels is actually better than pixels/filsize, because it gives a number lower than 1 (usually, in my case) which doesn't absolutely require numeric sorting.
It does what I need for now, but whenever I need something more, I'll know where to look. Thanks!
Hello Thany,
give the ImagePrintsize.vbs script for the content plugin ScriptWDX a try: It supports calculated values for
%bytPerPixFile% ... Bytes per pixel (based on "gross" filesize - that's the filesize in bytes as shown in TC, thus size for pure image data plus size of metadata (like EXIF information) plus other "overhead" (like file header and so on))
%pixPerBytFile% ... Pixel per byte (based on "gross" filesize)
%bytPerPixImg% ... Bytes per pixel (based on "net" filesize - that's "gross" filesize minus size of embedded metadata)
%pixPerBytImg% ... Pixel perbyte (based on "net" filesize)
You can define one or more colum definitions for a custom column view and assign one or more result strings from the script to these columns. By default, the script returns a formatted string in the form
"%bytPerPixImg% b/Pix • %pixPerBytImg% Pix/b • Comp: %imgComp% • Q: %imgQual%"
in "Result2"
See http://www.ghisler.ch/board/viewtopic.php?t=9986 for further details (it's on the german board, but - if needed - google translate may help... or just ask here for help
give the ImagePrintsize.vbs script for the content plugin ScriptWDX a try: It supports calculated values for
%bytPerPixFile% ... Bytes per pixel (based on "gross" filesize - that's the filesize in bytes as shown in TC, thus size for pure image data plus size of metadata (like EXIF information) plus other "overhead" (like file header and so on))
%pixPerBytFile% ... Pixel per byte (based on "gross" filesize)
%bytPerPixImg% ... Bytes per pixel (based on "net" filesize - that's "gross" filesize minus size of embedded metadata)
%pixPerBytImg% ... Pixel perbyte (based on "net" filesize)
You can define one or more colum definitions for a custom column view and assign one or more result strings from the script to these columns. By default, the script returns a formatted string in the form
"%bytPerPixImg% b/Pix • %pixPerBytImg% Pix/b • Comp: %imgComp% • Q: %imgQual%"
in "Result2"
See http://www.ghisler.ch/board/viewtopic.php?t=9986 for further details (it's on the german board, but - if needed - google translate may help... or just ask here for help