graphicsmagick / linux

gm identify  Monterey.jpg

Monterey.jpg JPEG 1920x1080+0+0 DirectClass 8-bit 535.4Ki 0.000u 0m:0.000001s

display 

animate=show animation eg gif

composite=blend/merge image togather

conjure = interprets MSL


convert

import=read image from window

mogrify= image scaling, image rotation, color reduction etc overwrites original

montage =tiled image

options

-adjoin = join images into a single multi-image file

image%02d.miff

-affine <matrix>

This option provides a transform matrix {sx,rx,ry,sy,tx,ty} for use by subsequent -draw or -transform options.

-antialias

remove pixel aliasing

-append

 creates a single image where the images in the original set are stacked top-to-bottom.

 -asc-cdl <spec>

-authenticate <string>

password for pdf

-auto-orient 

-average

average a set of images

 -backdrop

 -colorspace <value>

              the type of colorspace


              Choices are: CineonLog, CMYK, GRAY, HSL, HWB, OHTA, RGB,

              Rec601Luma, Rec709Luma, Rec601YCbCr, Rec709YCbCr, Transparent,

              XYZ, YCbCr, YIQ, YPbPr, or YUV.


  -comment "%m:%f %wx%h"

  -compress <type>

              the type of image compression

              Choices are: None, BZip, Fax, Group3, Group4, JPEG, Lossless,

              LZW, RLE, Zip, LZMA, JPEG2000, JPEG2000, JBIG, JBIG2, WebP, or

              ZSTD.

 Use the -quality option to set the compression level to be used

              by the JPEG, JPEG-2000, PNG, MIFF, MPEG, and TIFF encoders. Use

              the -sampling-factor option to set the sampling factor to be

              used by the DPX, JPEG, MPEG, and YUV encoders for downsampling

              the chroma channels.


-density <width>x<height>

  horizontal and vertical resolution in pixels of the image This

              option specifies the image resolution to store while encoding a

              raster image or the canvas resolution while rendering (reading)

              vector formats such as Postscript, PDF, WMF, and SVG into a

              raster image. Image resolution provides the unit of measure to

              apply when rendering to an output device or raster image. The

              default unit of measure is in dots per inch (DPI). The -units

              option may be used to select dots per centimeter instead.

               The default resolution is 72 dots per inch, which is equivalent

              to one point per pixel (Macintosh and Postscript standard).

              Computer screens are normally 72 or 96 dots per inch while

              printers typically support 150, 300, 600, or 1200 dots per inch.

              To determine the resolution of your display, use a ruler to

              measure the width of your screen in inches, and divide by the

              number of horizontal pixels (1024 on a 1024x768 display).  If

              the file format supports it, this option may be used to update

              the stored image resolution. Note that Photoshop stores and

              obtains image resolution from a proprietary embedded profile. If

              this profile is not stripped from the image, then Photoshop will

              continue to treat the image using its former resolution,

              ignoring the image resolution specified in the standard file

              header.  The density option is an attribute and does not alter

              the underlying raster image. It may be used to adjust the

              rendered size for desktop publishing purposes by adjusting the

              scale applied to the pixels. To resize the image so that it is

              the same size at a different resolution, use the -resample

              option.

-depth <value>

              depth of the image

              This is the number of bits of color to preserve in the image.

              Any value between 1 and QuantumDepth (build option) may be

              specified, although 8 or 16 are the most common values. Use this

              option to specify the depth of raw images whose depth is unknown

              such as GRAY, RGB, or CMYK, or to change the depth of any image

              after it has been read.  The depth option is applied to the

              pixels immediately so it may be used as a form of simple

              compression by discarding the least significant bits. Reducing

              the depth in advance may speed up color quantization, and help

              create smaller file sizes when using a compression algorithm

              like LZW or ZIP.


-format <string>

              output formatted image characteristics

              When used with the identify utility, or the convert utility with

              output written to the 'info:-' file specification, use this

              option to print information about the image in a format of your

              choosing.  You can include the image filename, type, width,

              height, Exif data, or other image attributes by embedding

              special format characters:


    %b   file size

                   %c   comment

                   %d   directory

                   %e   filename extension

                   %f   filename

                   %g   page dimensions and offsets

                   %h   height

                   %i   input filename

                   %k   number of unique colors

                   %l   label

                   %m   magick

                   %n   number of scenes

                   %o   output filename

                   %p   page number

                   %q   image bit depth

                   %r   image type description

                   %s   scene number

                   %t   top of filename

                   %u   unique temporary filename

                   %w   width

                   %x   horizontal resolution

                   %y   vertical resolution

                   %A   transparency supported

                   %C   compression type

                   %D   GIF disposal method

                   %G   Original width and height

                   %H   page height

                   %M   original filename specification

                   %O   page offset (x,y)

                   %P   page dimensions (width,height)

                   %Q   compression quality

                   %T   time delay (in centi-seconds)

                   %U   resolution units

                   %W   page width

                   %X   page horizontal offset (x)

                   %Y   page vertical offset (y)

                   %@   trim bounding box

                   %#   signature

                   \n   newlin


                  \r   carriage return

                   %%   %


  -format "%m:%f %wx%h"

   Where "<tag>" may be one of the following:

                 *  (print all Exif tags, in keyword=data format)

                   !  (print all Exif tags, in tag_number format)

                   #hhhh (print data for Exif tag #hhhh)

                   ImageWidth

                   ImageLength

                   BitsPerSample

                   Compression

                   PhotometricInterpretation

                   FillOrder

                   DocumentName

                   ImageDescription

                   Make

                   Model

                   StripOffsets

                   Orientation

                   SamplesPerPixel

                   RowsPerStrip

                   StripByteCounts

                   XResolution

                   YResolution

                   PlanarConfiguration

                   ResolutionUnit

                   TransferFunction

                   Software

                   DateTime

                   Artist

                   WhitePoint

                   PrimaryChromaticities

                   TransferRange

                   JPEGProc

                   JPEGInterchangeFormat


                   JPEGInterchangeFormatLength

                   YCbCrCoefficients

                   YCbCrSubSampling

                   YCbCrPositioning

                   ReferenceBlackWhite

                   CFARepeatPatternDim

                   CFAPattern

                   BatteryLevel

                   Copyright

                   ExposureTime

                   FNumber1

                   IPTC/NAA

                   ExifOffset

                   InterColorProfile

                   ExposureProgram

                   SpectralSensitivity

                   GPSInfo

                   ISOSpeedRatings

                   OECF

                   ExifVersion

                   DateTimeOriginal

                   DateTimeDigitized

                   ComponentsConfiguration

                   CompressedBitsPerPixel

                   ShutterSpeedValue

                   ApertureValue

                   BrightnessValue

                   ExposureBiasValue

                   MaxApertureValue

                   SubjectDistance

                   MeteringMode

                   LightSource

                   Flash

                   FocalLength

                   MakerNote

                   UserComment

                   SubSecTime

                   SubSecTimeOriginal

                   SubSecTimeDigitized

                   FlashPixVersion

                   ColorSpace

                   ExifImageWidth

                   ExifImageLength

                   InteroperabilityOffset

                   FlashEnergy

                   SpatialFrequencyResponse

                   FocalPlaneXResolution

                   FocalPlaneYResolution

                   FocalPlaneResolutionUnit

                   SubjectLocation

                   ExposureIndex

                   SensingMethod

                   FileSource

                   SceneType


 JPEG specific information (from reading a JPEG file) may be

              obtained like this:


                   %[JPEG-<tag>]


              Where "<tag>" may be one of the following:


                   *                 (all JPEG-related tags, in

                                      keyword=data format)

                   Quality           IJG JPEG "quality" estimate

                   Colorspace        JPEG colorspace numeric ID

                   Colorspace-Name   JPEG colorspace name

                   Sampling-factors  JPEG sampling factors


-geometry <width>x<height>{+-}<x>{+-}<y>{%}{@}{!}{^}{<}{>}


              Specify dimension, offset, and resize options.

example 

gm convert -resize 300 image.png resize-300-image.png


gm convert -resize 300*300


gm convert -flop     =  mirror image 


gm convert -flip    = flip verticaly 


gm convert -monochrome 


gm convert input.jpg -resize 300x output.jpg = preserve aspect ratio

gm convert input.jpg -resize x200 output.jpg = same

gm convert input.jpg -thumbnail 300x200^ -gravity center -extent 300x200 output.jpg 

   

 convert -list format

sudo apt install libsixel-bin

img2sixel 

-7, -8: Selects the SIXEL graphics norm. -7 selects the VT level 3 norm (default), and -8 selects the VT level 4 norm.

-e: Enables relative color specification.

-I: Ignores delays in GIF animations.

-i: Inverts the color output.

-u: Uses built-in dithering instead of an external one.

-g: Enables gamma correction.

-v: Prints the version number and exits.

-S, -P, -D, -O, -V, -H: Various options for handling GIF animations.

-p colors: Specifies the number of colors to use.

-m file: Specifies a source file for color quantization.

-d diffusiontype: Specifies the type of error diffusion.

-f findtype: Specifies the method for finding the nearest color.

-s selecttype: Specifies the method for selecting representative colors.

-c geometory: Specifies the output device’s screen geometry.

-w width, -h height: Specifies the width and height of the output image.

-r resamplingtype: Specifies the method for resampling.

-q quality: Specifies the output quality.

-l loopmode: Specifies the loop mode for GIF animations.

-t palettetype: Specifies the type of palette to use.

-n macronumber: Specifies the macro number for DEC SIXEL.

-C score: Specifies the score for color matching.

-b palette: Specifies the palette file.

-E encodepolicy: Specifies the policy for encoding.

-B bgcolor: Specifies the background color.

-o outfile: Specifies the output file. If not specified, the output is written to standard output.

filename ...: Specifies the input file(s). If not specified, the input is read from standard input.


stty size

43 158

cat catimg

width=$(tput cols)

height=$(tput lines)

width=$((width * 16))

height=$((height * 16))

img2sixel -w $width -h $height $1

resampling  -r

 nearest  -> Nearest-Neighbor method

            gaussian -> Gaussian filter

            hanning  -> Hanning filter

            hamming  -> Hamming filter

            bilinear -> Bilinear filter (default)

            welsh    -> Welsh filter

            bicubic  -> Bicubic filter

            lanczos2 -> Lanczos-2 filter

            lanczos3 -> Lanczos-3 filter

            lanczos4 -> Lanczos-4 filter



lossless compression tools

https://imageoptim.com/versions.html

https://imageoptim.com/online


sudo apt-get install trimage

using optipng, pngcrush, advpng and jpegopti 

MozJPEG, pngquant, Pngcrush, 7zip, SVGO and Google Zopfli


 https://github.com/google/guetzli

A perceptual JPEG encoder, aiming for excellent compression density at high visual quality


sudo apt install guetzli 

https://www.kokkonen.net/tjko/projects.html#jpegoptim

JPEG optimization utility providing lossless and lossy compression.


sudo apt install jpegoptim 

https://optipng.sourceforge.net

optiPNG is a PNG optimizer that recompresses image files to a smaller size, without losing any information. This program also converts external formats (BMP, GIF, PNM and TIFF) to optimized PNG, and performs PNG integrity checks and corrections.  


sudo apt install optipng 

https://github.com/shssoichiro/oxipng

Multithreaded PNG optimizer written in Rust 


cargo install oxipng

 https://pmt.sourceforge.io/pngcrush/

sudo apt install pngcrush 

 

other

https://converseen.fasterland.net

sudo apt install converseen 

uses imagemagick


https://cairosvg.org/

pip3 install cairosvg

 

https://dechifro.org/dcraw/

 https://www.gmic.eu/

sudo apt install gmic

 

https://www.imagemagick.org/script/index.php

 https://github.com/nagadomi/waifu2x

 https://waifu2x.udp.jp/

 

 https://pngquant.org/

Lossy compression of PNG images. 

sudo apt install pngquant 


https://github.com/google/zopfli

Zopfli Compression Algorithm is a compression library programmed in C to

 perform very good, but slow, deflate or zlib compression. 

Highly efficient PNG optimisation tool using Google's zopfli library 

 sudo apt install zopfli 

 

https://github.com/Huluti/Curtail