Then I created the following gnuplot command file plot.cmd: set title 'Plotted with Gnuplot' Then I ran each of the files through the first script, like this: for f in xx*.jpg do. That gives me files called xx1.jpg with 1% noise, xx2.jpg with 2% noise and so on, up to xx99.jpg with 99% noise. # Make greyscale version for entropy calculationĮntropy=$(identify -verbose -features 1 temp.jpg | grep -A1 " Entropy:" | tail -n 1 | awk -F, '.jpg done Jsize=$(convert "$f" -strip JPG:- | wc -c) I made a little script to calculate the following for a given input file: I do not have a pile of sample images to test my theory on, so I did it a different way. Ok, I have had a little more time to spend on this now. I think the last value is the only one you need consider. There are 5 values for each type of entropy - horizontal, vertical, left diag, right diag and overall. I suspect images with a higher entropy will compress better as JPEGs and those with a lower entropy will fare better as PNGs - but I have to dash now :-) If you use ImageMagick, you can calculate the Entropy easily like this: identify -verbose -features 1 image.jpg | grep -i -A1 entropy Imagick::clampImage - Restricts the color range from 0 to the quantum depth.I have absolutely no time to develop this line of thought further but the image entropy is probably a good discriminant for selecting JPEG or PNG - see my earlier comment on your question.Imagick::chopImage - Removes a region of an image and trims.Imagick::charcoalImage - Simulates a charcoal drawing.Imagick::brightnessContrastImage - Change the brightness and/or contrast of an image.Imagick::borderImage - Surrounds the image with a border.Imagick::blurImage - Adds blur filter to image.Imagick::blueShiftImage - Mutes the colors of the image.Imagick::blackThresholdImage - Forces all pixels below the threshold into black.Imagick::averageImages - Average a set of images.Imagick::autoLevelImage - Adjusts the levels of a particular image channel.Imagick::appendImages - Append a set of images.Imagick::annotateImage - Annotates an image with text. Imagick::animateImages - Animates an image or images.Imagick::affineTransformImage - Transforms an image.Imagick::addNoiseImage - Adds random noise to the image.Imagick::addImage - Adds new image to Imagick object image list.Imagick::adaptiveThresholdImage - Selects a threshold for each pixel based on a range of intensity.Imagick::adaptiveSharpenImage - Adaptively sharpen the image.Imagick::adaptiveResizeImage - Adaptively resize image with data dependent triangulation.Imagick::adaptiveBlurImage - Adds adaptive blur filter to image. Getting Started Introduction A simple tutorial Language Reference Basic syntax Types Variables Constants Expressions Operators Control Structures Functions Classes and Objects Namespaces Enumerations Errors Exceptions Fibers Generators Attributes References Explained Predefined Variables Predefined Exceptions Predefined Interfaces and Classes Predefined Attributes Context options and parameters Supported Protocols and Wrappers Security Introduction General considerations Installed as CGI binary Installed as an Apache module Session Security Filesystem Security Database Security Error Reporting User Submitted Data Hiding PHP Keeping Current Features HTTP authentication with PHP Cookies Sessions Dealing with XForms Handling file uploads Using remote files Connection handling Persistent Database Connections Command line usage Garbage Collection DTrace Dynamic Tracing Function Reference Affecting PHP's Behaviour Audio Formats Manipulation Authentication Services Command Line Specific Extensions Compression and Archive Extensions Cryptography Extensions Database Extensions Date and Time Related Extensions File System Related Extensions Human Language and Character Encoding Support Image Processing and Generation Mail Related Extensions Mathematical Extensions Non-Text MIME Output Process Control Extensions Other Basic Extensions Other Services Search Engine Extensions Server Specific Extensions Session Extensions Text Processing Variable and Type Related Extensions Web Services Windows Only Extensions XML Manipulation GUI Extensions Keyboard Shortcuts ? This help j Next menu item k Previous menu item g p Previous man page g n Next man page G Scroll to bottom g g Scroll to top g h Goto homepage g s Goto search
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |