I recently discovered a command line picture editing tool Imagemagick
which has a tool called mogrify
.
I would like someone to explain the -extract
command (See here if you need reference)
Let me show you'll what I did. This is the original image:
I then made two copies of this (using any command edits the original file). To the first i used the command
mogrify -extract 500x500+224+202 '/home/ashhab/Desktop/Abstract_Wallpaper (copy).jpg'
Then i get this
For the second I used this command
mogrify -extract 500x500 '/home/ashhab/Desktop/Abstract_Wallpaper (another copy).jpg'
and i get this
The command can be explained as
mogrify -extract (size)(offset) [file path]
So my question is what does the offset(+224+202
) actually do? what does offset mean?
The offset means the location where it should start extracting the image. So an offset of +224+202 means go 224 to the right and 202 to the bottom and from that point take out the 500x500 pixels you want (In this case it will be pixels but it can also be a percentage).
From your link
If you omit the offsets, as in ... the image is resized to the specified dimensions instead
. So the 3rd one is a 500x500 version of the original and it is zoomed but zoomed out.