Forrest logo
back to the jpegtran tool

jpegtran:tldr:29844

jpegtran: Crop the image to a rectangular region of width `W` and height `H`, starting at point `X` and `Y` from the upper-left corner.
$ jpegtran -crop ${W}x${H}+${X}+${Y} ${path-to-image-jpg} > ${path-to-output-jpg}
try on your machine

This command is using the jpegtran tool to perform a cropping operation on a JPEG image.

  • jpegtran is a command-line utility for manipulating JPEG files.
  • The -crop option specifies that a cropping operation will be performed on the image.
  • ${W}x${H} specifies the dimensions of the cropped region. ${W} and ${H} are variables representing the width and height, respectively.
  • +${X}+${Y} specifies the position of the top-left corner of the cropped region relative to the original image. ${X} and ${Y} are variables representing the X and Y coordinates, respectively.
  • ${path-to-image-jpg} is the path to the input JPEG image file that will be cropped.
  • >${path-to-output-jpg} redirects the output of the jpegtran command to a new file specified by ${path-to-output-jpg}.

In summary, this command crops an input JPEG image to a specified size and position and saves the cropped image to a new file. The variables ${W}, ${H}, ${X}, and ${Y} need to be replaced with appropriate values for the specific cropping operation.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the jpegtran tool