Go give a big GitHub star to Colorist and jq if it was! They’re the real heroes. If the original width was less than 1000px, I just use the original width. The rest of the script is simple if the new width is smaller than 1000px, I set it to 1000px. You could try to parse json with pure bash, but I’d rather brew install jq and be done with it! That line gives us, in json format, a bunch of information about foo.png including the copyrights, colors, luminance… Since all I care about is the width, I extract that with jq: jq '.width'. But we can get the original image’s dimensions by using colorist identify "foo.png" -json. avif" -resize $((newWidth )) doneĬolorist’s -resize doesn’t accept percentages. The efficiency whether at work or study will be greatly. You can just drag and drop multiple images to the area, and compress them all directly. Want to free up more space and compress all photos on the whole Aiseesoft Free Image Compressor Online allows you to compress up to 40 images at one time. Do name = ` echo " $ " ` cleanedName = $( echo " $i " | cut -f 1 -d '.' ) ogWidth = $(colorist identify " $name " -json | jq '.width' ) # gets the original image's width newWidth = $((ogWidth / 2 )) if ] then newWidth = 1000 fi if ] then newWidth =ogWidthįi colorist convert " $name " " $cleanedName. Batch Compress Images for Higher Efficiency.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |