And where do you make “nails”?

    When it comes to  web development, sooner or later the question arises of how and in what way to prepare thumbnail images on the side of the web server. The question of manual preparation disappears automatically, it is much more pleasant to upload a picture and not think about anything else. Here's how not to think and it will be discussed.

    At first, as probably many, 2 magnificent libraries ImageMagick  and  GD were opened to my mind .
    Rich functionality and all that, I won’t describe the charms ... because it's not about them. And at first I thought that there was no limit to perfection, until I came across a hosting on which there is no PHP and no Perl (I write in  Parser , if that). And there really was a problem.
    The solution was found by itself , poking around in your favorite XnView image viewerI found a funny utility NConvert which allows you to do various manipulations with graphic files (a long list of functions + support for 400 graphic formats + implementation for all platforms).
    One of the most remarkable advantages that I noted for myself is changing jpeg files (rotation, reflection) without recompression. Is this not a fairy tale. I even wrote an article on the  Parser forum (read to anyone interested).
    However, just a week ago, my mind again made me rush in search of the perfect solution, and it was found.
    Meet  - jpegtran The
    utility that is on all Unix-like systems is included in the jpeg library. There is also an implementation for  Windows .
    What does she allow to do? It allows you to perform various manipulations (cropping meta data, rotation, reflection, crop, resizing , etc. ) with jpeg without recompression.
    Full feature list:
    usage: jpegtran [switches] [inputfile]
    Switches (names may be abbreviated):
    -copy none Copy no extra markers from source file
    -copy comments Copy only comment markers (default)
    -copy all Copy all extra markers
    -optimize Huffman table (smaller file, but slow compression)
    -progressive Create progressive JPEG file
    Switches for modifying the image:
    -grayscale Reduce to grayscale (omit color data)
    -flip [horizontal | vertical] Mirror image ( left-right  or  top-bottom )
    -rotate [90 | 180 | 270] Rotate image (degrees clockwise)
    -transpose image
    -transverse transpose image
    -trim Drop non-transformableedge blocks
    Switches for advanced users:
    -restart N Set restart interval in rows, or in blocks with B
    -maxmemory N Maximum memory to use (in kbytes)
    -outfile name Specify name for output file
    -verbose or -debug Emit debug output
    Switches for wizards:
    -scans file Create multi-scan JPEG per script file

    Read about crop and resize functions  here .
    The utility in the assembly under RedHat weighs some 18 Kb.
    It was not possible to measure the working speed adequately, but according to my own feelings it was very fast. :)
    Maybe I still don’t know what you are using.

    Also popular now: