~~Title: Image ~~ The **Image** internal command can be used to: * Change the format of images * Resize and rotate images * Upload or synchronize images with an online service * Locate an image using its embedded GPS information The `Image CONVERT` command displays the [[:additional_functionality:image_conversion|image conversion]] dialog in interactive mode, letting you select the conversion options to apply to selected images. Using the various arguments of this command it is possible to automate the image conversion function. The image conversion function can accept as input any image format that Opus is able to view (including those supported by plugins), but can only output in JPEG, PNG, GIF or Bitmap formats. **Command Arguments:** $$ Argument $$ Type $$ Possible values $$ Description $$ ADDSUFFIX $$ /O $$ //(no value)// $$ Add a suffix to the output filename when resizing images. The suffix used indicates the new image size. If the image is not resized, no suffix is added. ``Image CONVERT=jpg WIDTH=1024 HEIGHT=768 ADDSUFFIX`` $$ $$ $$ //// $$ Adds the specified suffix to the output filename. ``Image CONVERT=jpg WIDTH=128 HEIGHT=128 ADDSUFFIX=thumb`` The specified suffix is used provided a new image is written, but there are cases where no image will be written by default, such as when converting images in-place (not to a separate destination directory) and the source image already matches the specified criteria. If you need to ensure that a second copy of the image is created no matter what, using the specified suffix to modify its name, then you should prefix the suffix with the keyword **always:**. ``Image CONVERT=jpg WIDTH=128 HEIGHT=128 ADDSUFFIX=always:thumb`` $$ AS $$ /K $$ //// $$ Specify the output filename when converting images. By default the output filename is the same as the input filename, with the possibility of an additional suffix (with the **ADDSUFFIX** argument) and a different file extension if the image has been converted to a different format. ``Image CONVERT=jpg AS=thumbnail.jpg WIDTH=128 HEIGHT=128`` $$ BACKGROUND $$ /O $$ //RRR,GGG,BBB//\\ //(decimal)//\\ //#RRGGBB//\\ //(hexadecimal)// $$ When an image with an alpha channel (transparency) is converted to a format that doesn't support the alpha channel, this argument is used to specify the background color that replaces the transparent area. The color can be specified in either decimal or hex format. ``Image CONVERT=jpg BACKGROUND=#ff8000`` $$ $$ $$ **none** $$ Specify **BACKGROUND=none** in conjunction with a preset to override the saved setting. ``Image CONVERT PRESET=ScaleAndCrop BACKGROUND=none`` $$ CONVERT $$ /O $$ //(no value)// $$ Displays the [[:additional_functionality:image_conversion|image conversion]] dialog in interactive mode when no other arguments are provided. ``Image CONVERT`` $$ $$ $$ **jpg** $$ Automates the image conversion function; the converted image will be saved in JPEG format. ``Image CONVERT=jpg`` $$ $$ $$ **png** $$ The converted image will be saved in PNG format. ``Image ROTATE=EXIF CONVERT=png`` $$ $$ $$ **gif** $$ The converted image will be saved in GIF format. ``Image WIDTH=128 HEIGHT=128 CONVERT=gif`` $$ $$ $$ **bmp** $$ The converted image will be saved in BMP format. ``Image CONVERT=bmp`` $$ CROP $$ /K $$ $$ Crops selected images. The crop parameters can be specified in several ways: |W,H|Crop to specified size (width,height). Centers the crop rectangle in the original image.| |X,Y,W,H|Crop from specified position (x,y) to specified size (width,height).| |X,Y-X1,Y1|Crop from specified position (x,y) to specified position (x1,y1).| |W:H|Crop to specified ratio (width:height). Centers the crop rectangle in the original image.| |X,Y,W:H|Crop from specified position (x,y) to specified ratio (width:height).| ``Image CONVERT CROP=16:9`` $$ $$ $$ **no** $$ Specify **CROP=no** in conjunction with a preset to override the saved setting and disable cropping. ``Image CONVERT PRESET=ScaleAndCrop CROP=no`` $$ FLIP $$ /K $$ **h** $$ Flip (mirror) the image horizontally. ``Image FLIP=h`` $$ $$ $$ **v** $$ Flip the image vertically. ``Image FLIP=v ROTATE=90 HERE`` $$ $$ $$ **no** $$ Specify **FLIP=no** in conjunction with a preset to override the saved setting. ``Image CONVERT PRESET=ScaleAndRotate FLIP=no`` $$ FROM $$ /M $$ // ...// $$ Specify the image file or files to operate on. Without this argument the command will operate on all currently selected files. This is the default argument for the Image command and so you do not need to specify the FROM keyword. Remember that if the filename contains a space it needs to be enclosed in quotes. ``Image CONVERT=png FROM C:\MyPhotos\*.jpg HERE`` $$ HEIGHT $$ /K/N $$ //// $$ Resize the image to the specified height. ``Image HEIGHT=768 PRESERVEASPECTRATIO CONVERT=jpg`` $$ HERE $$ /S $$ //(no value)// $$ Write converted images to the source folder. Without this argument converted images are written to the current destination folder. ``Image CONVERT=bmp WIDTH=128 HEIGHT=128 ADDSUFFIX HERE`` $$ LOCATE $$ /K $$ //// $$ Locates the real-world position of the selected image file from its embedded GPS information, using a third-party mapping service. With the exception of Google Earth (which must be installed on your machine), all services open a web browser. The list of location services is configurable via **[[:preferences:preferences_categories:miscellaneous:advanced_options|Preferences / Miscellaneous / Advanced]]: image_locate_services.** Several services are defined by default, these are listed below. If the selected image does not have GPS information this command will have no effect. ``Image LOCATE=`` $$ $$ $$ **bing** $$ Locates the image using Bing maps (will open in a web browser). ``Image LOCATE=bing`` $$ $$ $$ **google** $$ Locates the image using Google maps (will open in a web browser). ``Image LOCATE=google`` $$ $$ $$ **googleearth** $$ Locates the image using Google Earth (the software must be installed on your computer for this to work). Supports multiple images selected at once. ``Image LOCATE=googleearth`` $$ $$ $$ **kml** $$ Locates the image using the default handler for **.kml** (//Keyhole Markup Language//) files on your computer. This is the format Google Earth uses; indeed, this option does exactly the same thing as the **googleearth** option does except that it doesn't specifically check for the existence of Google Earth (and so will work with any app that implements default handling for //.kml// files). ``Image LOCATE=kml`` $$ $$ $$ **osm** $$ Locates the image using Open Street Map (will open in a web browser). ``Image LOCATE=osm`` $$ $$ $$ **windowsmaps** $$ Locates the image using Windows Maps (included by default in Windows 10). Supports multiple images selected at once (up to 25 maximum). ``Image LOCATE=windowsmaps`` $$ $$ $$ **menu** $$ Generates a menu listing the configured location services. Selecting an item from the menu will launch the service to locate the selected image. ``Image LOCATE=menu`` $$ $$ $$ **nohide** $$ Use this in conjunction with **menu**. By default services that are unavailable will be hidden from the menu - add the **nohide** parameter to disable them rather than hiding them. ``Image LOCATE=menu,nohide`` $$ NOADDSUFFIX $$ /S $$ //(no value)// $$ Specify **NOADDSUFFIX** in conjunction with a preset to override the saved setting. ``Image CONVERT PRESET=ScaleAndCrop NOADDSUFFIX`` $$ NOAUTORUN $$ /S $$ //(no value)// $$ Even if the other arguments on the command line would allow for automated image conversion, if **NOAUTORUN** is specified the conversion dialog will open first. This lets you use the other arguments to pre-configure the dialog but then make final adjustments manually. ``Image CONVERT=png CROP=4:3 NOAUTORUN`` $$ NOENLARGE $$ /O $$ //(no value)// $$ Prevents images from being enlarged if the resize operation would otherwise cause this. Selected images that are already smaller than the specified size will remain untouched. ``Image CONVERT=jpg WIDTH=1024 HEIGHT=768 NOENLARGE`` $$ $$ $$ **no** $$ Specify **NOENLARGE=no** in conjunction with a preset to override the saved setting. ``Image CONVERT PRESET=ScaleAndCrop NOENLARGE=no`` $$ NOLOSSLESS $$ /O $$ //(no value)// $$ Disables the ability of Opus to perform lossless JPEG rotation. Normally Opus will rotate JPEG images losslessly if possible, but you may specifically want to recompress the image to a lower quality (to make it smaller) and this keyword allows you to do that. You can also use this without performing a rotation, if all you want to do is recompress a JPEG image to a different quality setting. ``Image CONVERT=jpg QUALITY=50 ROTATE=EXIF NOLOSSLESS`` $$ $$ $$ **no** $$ Specify **NOLOSSLESS=no** in conjunction with a preset to override the saved setting. ``Image CONVERT PRESET=ScaleAndRotate NOLOSSLESS=no`` $$ NOREDUCE $$ /O $$ //(no value)// $$ Prevents images from being reduced in size if the resize operation would otherwise cause this. Selected images that are already larger than the specified size will remain untouched. ``Image CONVERT=jpg WIDTH=800 HEIGHT=600 NOREDUCE`` $$ $$ $$ **no** $$ Specify **NOREDUCE=no** in conjunction with a preset to override the saved setting. ``Image CONVERT PRESET=ScaleAndCrop NOREDUCE=no`` $$ NORENAME $$ /S $$ //(no value)// $$ Specify **NORENAME** in conjunction with a preset to override the saved setting. ``Image CONVERT PRESET=ScaleAndCrop NORENAME`` $$ NOUSEIMAGEDATA $$ /S $$ //(no value)// $$ When used with the **CONVERT** argument (in the standalone image viewer), overrides the **@useimagedata** command modifier and makes the image converter load the image from disk rather than obtaining it from the viewer. ``Image CONVERT NOUSEIMAGEDATA`` $$ PERCENT $$ /K/N $$ //// $$ Resize the image to the specified percentage of the original size. This can enlarge images as well as reduce them. You can set this to 0 or 100 to disable percentage resizing and override the settings in a saved preset. ``Image CONVERT=jpg PERCENT=125`` $$ PRESERVEASPECTRATIO $$ /O $$ //(no value)// $$ Preserve the original aspect ratio when resizing images. The output width or height will be automatically adjusted to ensure the aspect ratio is maintained. Using this switch means you can resize an image by just supplying a new width or a new height - this missing dimension will be calculated automatically. ``Image CONVERT=png WIDTH=1280 PRESERVEASPECTRATIO HERE`` $$ $$ $$ **no** $$ Specify **PRESERVEASPECTRATIO=no** in conjunction with a preset to override the saved setting. ``Image CONVERT PRESET=ScaleAndCrop PRESERVEASPECTRATIO=no`` $$ PRESERVEDATE $$ /S $$ //(no value)// $$ When converting images, this option preserves the //creation// and //last modified// timestamps of the original file. By default, when this option is not specified, the //last modified// timestamp will be updated to the current time, as will the //creation// timestamp if the operation creates a new file. (Operations which convert an existing file "in place", overwriting the original with **REPLACE HERE**, will preserve the //creation// timestamp regardless of this option.) ``Image ROTATE=EXIF REPLACE HERE PRESERVEDATE`` $$ PRESET $$ /K $$ //// $$ Invokes a saved preset on selected images. Presets can be created via the user interface (run `Image CONVERT` by itself with no other arguments) - once saved, they can be automated using the **PRESET** argument. Any other supplied arguments will override the settings in the preset. ``Image CONVERT=jpg PRESET=HDResize`` $$ $$ $$ **!default** $$ Use this to display the conversion dialog with its default settings. Otherwise, if no preset is specified, the last used settings are loaded. ``Image CONVERT PRESET=!default`` $$ $$ $$ **!list** $$ Generates a list of saved presets. Selecting a preset from the list will run it on all selected images. ``Image CONVERT PRESET=!list`` $$ $$ $$ **!menu** $$ Generates a menu of saved presets. Selecting a preset from the menu will run it on all selected images. ``Image CONVERT PRESET=!menu`` $$ QUALITY $$ /K/N $$ //// $$ Specify the quality (1 - 100) when an image is saved in JPEG format. ``Image CONVERT=jpg QUALITY=10 NOLOSSLESS`` $$ REPLACE $$ /O $$ //(no value)// $$ Automatically replaces existing files in the destination folder. Use this in conjunction with the **HERE** argument to convert an image "in-place". This only applies if the output filename is the same as the input filename - if the output filename has changed (via **ADDSUFFIX**, etc) and the file already exists, you will still be prompted for confirmation. ``Image ROTATE=EXIF REPLACE`` $$ $$ $$ **always** $$ Always replace existing files, even if the output filename has changed. ``Image PERCENT=50 ADDSUFFIX HERE REPLACE=always`` $$ $$ $$ **no** $$ Specify **REPLACE=no** in conjunction with a preset to override the saved setting. ``Image CONVERT PRESET=ScaleAndCrop REPLACE=no`` $$ $$ $$ **readonly** $$ Replace existing files, even if they are read-only, without prompting. (Has no effect if read-only prompts are turned off in Preferences.) ``Image PERCENT=50 REPLACE=readonly`` Can be combined with **always**: ``Image PERCENT=50 REPLACE=always,readonly`` $$ ROTATE $$ /K $$ //// $$ Rotate the image the specified angle (in degrees). Positive values rotate clock-wise, negative values counter-clockwise. You can set this to 0 to disable rotation and override the saved setting within a preset. ``Image ROTATE=90 HERE REPLACE`` $$ $$ $$ **EXIF** $$ Uses the rotation (orientation) information stored in the images' EXIF tags to rotate the image. The effect of this is to negate the original orientation of the camera, resulting in a "right way up" image. If the selected image does not have an EXIF rotation tag this operation has no effect. ``Image ROTATE=EXIF HERE REPLACE`` $$ $$ $$ **RESET** $$ Does not actually rotate the image data, but will clear out the rotation (orientation) field from the images' EXIF tags. ``Image ROTATE=RESET HERE REPLACE`` $$ TO $$ /K $$ //// $$ Specifies the destination path for converted images. Remember to enclose the path in quotes if it contains spaces. If not provided, and the **HERE** argument is not specified, the current destination file display will be used as the target path. ``Image CONVERT=jpg WIDTH=80 HEIGHT=80 TO "C:\Photos\Image Thumbnails"`` $$ TODEST $$ /S $$ //(no value)// $$ Forces the output to go to the current destination folder. This lets you override the saved destination within a preset. ``Image CONVERT PRESET=ScaleAndCrop TODEST`` $$ WIDTH $$ /K/N $$ $$ Resize the image to the specified width. ``Image WIDTH=1024 PRESERVEASPECTRATIO CONVERT=jpg``