Personally I would create a .vrt using gdal_translate, with these
"additional command line parameters":

 -b 1 -b 2 -b 3 -b 1 -colorinterp_4 alpha -scale_4 0 255 255 255

This assumes 8 bit RGB input, but you can adapt it for something else.
It does work even before georeferencing.
But depending on your workflow it might be easier just to convert to RGBA
with something like imagemagick, or to open in MS Paint and save as
PNG, which silently adds an alpha channel.

Regards,
Alister

> Date: Mon, 24 Jan 2022 10:33:56 -0400
> From: Kirk Schmidt <k...@nortekresources.com>
> To: qgis-user@lists.osgeo.org
> Subject: Re: [Qgis-user] Adding alpha band to raster
> Message-ID: <46938c47-4f37-44ac-5f96-468f29258...@nortekresources.com>
> Content-Type: text/plain; charset=UTF-8; format=flowed
>
> Hi Nicolas:
>
> I just had an idea, why not use gdal directly??? I know gdalwarp has a
> -dstalpha switch to code null data Assuming this is what you want the
> alpha band for)
>
> Kirk
>
>
> On 1/21/2022 6:06 PM, Nicolas Cadieux wrote:
> > Hi,
> >
> > I don't see it in the current processing algorithms. I see lot's or
> > r.out... but not that one:(? I guess I could do it in Grass...
> >
> > Thanks for the idea!
> >
> > Nicolas
> >
> > On 2022-01-21 1:37 p.m., Kirk Schmidt wrote:
> >> Hi Nicholas:
> >>
> >> Try r.out.gdal
> >>
> >> https://grass.osgeo.org/grass78/manuals/r.out.gdal.html
> >>
> >> Kirk Schmidt
> >>
> >>
> >> On 1/21/2022 2:25 PM, Nicolas Cadieux wrote:
> >>> Hi,
> >>>
> >>> What is the easiest way, in QGIS3, to add an alpha band to a
> >>> raster?? Alpha bands are handy with the georeferencer. Currently, I
> >>> am just adding it in GIMP before I start the georeferencer.
> >>>
> >>> Thanks
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to