0

Is it possible to set your output file for the Clip Raster by Mask Layer tool as a jpg and not a tiff? Are there extra parameters or commands I can use to do this?

I can export as tiff and convert to jpg with another program but I am doing this for a large amount of features and it's extremely inefficient.

  • OT: Some image-editing software, like xn-view, offer batch operations, e.g. when it comes to conversion. – Erik Jan 17 at 17:02
  • Thanks Erik I have been using Adobe Bridge for batch conversion but It still takes five times as long to convert them as it does to produce them with the Clip Raster by Mask function. I'm working with a large number of images so it's essential that I clip straight to jpeg. If there is some extra parameters to do this, it would change everything. Thank you though – Mike Walters Jan 17 at 17:10
  • Maybe I can find some python code to add in the console. – Mike Walters Jan 17 at 17:17
1

You can save the output image using Clip raster by mask layer tool as JPG if you want. Just select from the dropdown menu of Files of type the JPG format instead of TIFF format, as you can see below:

enter image description here

enter image description here

Update

Although the JPG format is listed in the output file formats, it looks like it is not supported as a valid raster format for clip image. I also tried using the Clip tool located in the main toolbar from Raster -> Extraction -> Clipper and I chose .jpg as output raster file format, and I received the following error:

Output driver `JPEG' not recognised or does not support direct output file creation.

And it shows which file formats are supported:

The following format drivers are configured and support direct output:
VRT: Virtual Raster
GTiff: GeoTIFF
NITF: National Imagery Transmission Format
HFA: Erdas Imagine Images (.img)
ELAS: ELAS
MEM: In Memory Raster
BMP: MS Windows Device Independent Bitmap
PCIDSK: PCIDSK Database File
PCRaster: PCRaster Raster File
ILWIS: ILWIS Raster Map
SGI: SGI Image File Format 1.0
Leveller: Leveller heightfield
Terragen: Terragen heightfield
netCDF: Network Common Data Format
HDF4Image: HDF4 Dataset
ISIS3: USGS Astrogeology ISIS cube (Version 3)
ISIS2: USGS Astrogeology ISIS cube (Version 2)
PDS4: NASA Planetary Data System 4
ERS: ERMapper .ers Labelled
RMF: Raster Matrix Format
RST: Idrisi Raster A.1
INGR: Intergraph Raster
GSBG: Golden Software Binary Grid (.grd)
GS7BG: Golden Software 7 Binary Grid (.grd)
PDF: Geospatial PDF
MBTiles: MBTiles
MRF: Meta Raster Format
PNM: Portable Pixmap Format (netpbm)
PAux: PCI .aux Labelled
MFF: Vexcel MFF Raster
MFF2: Vexcel MFF2 (HKV) Raster
BT: VTP .bt (Binary Terrain) 1.3 Format
LAN: Erdas .LAN/.GIS
IDA: Image Data and Analysis
GTX: NOAA Vertical Datum .GTX
NTv2: NTv2 Datum Grid Shift
CTable2: CTable2 Datum Grid Shift
KRO: KOLOR Raw
ROI_PAC: ROI_PAC raster
RRASTER: R Raster
BYN: Natural Resources Canada's Geoid
NWT_GRD: Northwood Numeric Grid Format .grd/.tab
ADRG: ARC Digitized Raster Graphics
SAGA: SAGA GIS Binary Grid (.sdat, .sg-grd-z)
DB2ODBC: IBM DB2 Spatial Database
GPKG: GeoPackage
NGW: NextGIS Web
ENVI: ENVI .hdr Labelled
EHdr: ESRI .hdr Labelled
ISCE: ISCE raster

To answer your question, you need to choose any format from the formats listed above and it should work. JPG format is not supported as direct output.

  • Thank you so much for your reply, sorry I've been busy. I have tried this many times but it gives me no output. It will only create a tif file in the folder I choose, other file types will just run but output no image.?? any ideas? – Mike Walters Feb 6 at 18:16
  • In the console log I can see this "Output driver 'JPEG' not recognised or does not support direct output file creation. Anyway to change this?? – Mike Walters Feb 6 at 20:25
  • @MikeWalters I have updated my answer. JPG format is not supported as direct output although it is listed in output file formats. – ahmadhanb Feb 7 at 6:03
  • @ ahmadhanb Thanks again for the answer. I also noticed that. If I really wanted to create a jpg do you know where if anywhere in qgis I can find the source code for "Output driver"?? – Mike Walters Feb 7 at 23:22
  • @MikeWalters I think the clip tool relies on gdalwarp: gdal.org/gdalwarp.html where you can define the cutline and the -of: gdal.org/formats_list.html. However, based on the format list defined in gdal library, you cannot create .jpg format, but you can copy and do georeferencing. I think this is the answer to your question. You cannot create a JPEG file. – ahmadhanb Feb 8 at 5:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.