[Qgis-user] Clipping and keeping RGB scale

Mauricio Tecles mtecles at yahoo.com.br
Wed Oct 21 13:16:27 PDT 2020


 
Thank youfor your answer. I agree and realize that. Let me put it another way to describemy problem and what I need.

I need bmp(32 bits-RGBA, 2048x2048 pixels) and dds images, that each of them I will call apatch. These patches are square, created form (UTM, EPSG:32723) 5760mx5760m sizecuts of a large RGB composed satellite images.

This iswhat I used to do to create one patch with QGIS:

- From the RGBcomposed image I extracted (clip) a patch. Correct the min and max of each bandof the patch to reflect those values of the big RGB composed image.

- Zoom tothe patch layer (the only one displayed).

- Crtl-P(print).

- Selectprinter – I have no physical printer, so I used to select Microsoft XPSDocument Writer (the only one I could select the paper size defined by user).

- Pagesetup: select “size defined by user”.

- Add anew map to layout (the patch).

(Here Icould change the paper size or not. It would lead to the same good result).

- Itemproperties -> Extents: set X min, Y min, X max, Y max to the exact extentsof the patch.

- Layout:Resize layout (all margins are set to 0) – the image (the extents of the patch)as fit to the entire paper.

- Layout->Exportas Image…, select png and set to 2048x2048 pixels (page width, page height).

- Open thepng with Paint.net, save as bmp 32 bits (RGBA) and save as dds.

Myproblems:

- I need to cut at least 400 patches, trimmingeach one to the color scale of the big image is hard work, but possible to do. Anautomated (batch file?) to do that would be great! 

- The printlayout is not working anymore to fit the paper to the exact size of the image (the extents of the patch) (probably after some Windows update), even selecting “size defined by user”. Changing theextents and resizing does not have the same effect as before. The result is alwaysthe extent in the middle of the paper surrounded by a white border.

I have tried to make abigger clip (5x5 patches) then export as bmp (Projet->Import/Export->Exportmap to image…) to cut it with Paint.net, but it is impossible to match theextent and pixel size precisely. If I set the extent it turns to 10242x10242pixels. If I set to 10240x10240 pixels, as it should be, it reduces the extent.The same happens trying to export a patch this way.

Is there away to export/transform the tif patches (UTM, EPSG:32723, size: 5760mx5760m) tobmp (32 bits, 2048x2048 pixels) and dds? (gdal_translate, gdal_retile, OSGeo4WShell or other)?

Hints arewelcome!

Thank you,

Mauricio


    Em quarta-feira, 21 de outubro de 2020 00:31:17 BRT, <qgis-user at stripfamily.net> escreveu:  
 
  I don't think your issue is with the clip of the rasters, it is with how the software you are using sets the scale for the display of the layer.
 
 When you clip a layer in  QGIS or directly with gdal_translate, the default is to leave the pixel values exactly as they are, which is generally what you want. After all, if the software rescaled the max/min to some fixed value, then when you tried to display these side-by-side or reassemble them into a single image the values wouldn't make sense. 
 
 The issue you apparently are facing is that by default on loading a raster the software you are using finds the min and max value and scales the display to span that full range,  which is what QGIS does by default with raster layers. (The exact details of the scaling are determine by settings in the Settings -> Raster tab.)
 
 Without knowing what your display software is I can't suggest a solution. 
 
 
   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20201021/f57ef293/attachment.html>


More information about the Qgis-user mailing list