Skip to content

Latest commit

 

History

History
39 lines (27 loc) · 1.11 KB

File metadata and controls

39 lines (27 loc) · 1.11 KB

Tips for image editing

Make image background transparent

Using ImageMagick (here we have a white bg, but you can specify any color):

convert input-image.png -transparent white transparent.png

One can also use hex color codes for the same result:

convert input-image.png -transparent '#ffffff' transparent.png

Important: This does not work on JPEG images since JPEG does not support transparent background.

Source: SO.

Resize an image

convert input.jpg -resize 800x output.jpg     # Resize to a specific width while maintaining aspect ratio
convert input.jpg -resize 800x600 output.jpg  # Resize to fit within a maximum width and height (e.g., within a 800x600 pixel box)
convert input.jpg -resize 50% output.jpg      # Resize in a given proportion
mogrify -resize 50% image.jpg                 # Resize in place

Get image info

identify image.png
identify -verbose image.jpeg