I haven't been able to find any resources that can provide if in JPEG 2000 (JP2) transparency can be "built-in".
JPEG 2000 – Does JP2 Support Transparency When Created?
jpeg 2000transparency
Related Solutions
Based on huckfinn answers, few other comments and together with my findings:
Winning format is JPEG2000 (why and which version is mentioned below Why not others)
Why not others:
- JPEG
- Size limitation both data size and dimensions (4GB and 65500x65500)
- no (internal) pyramids possibility = bigger the image the longer it takes to display it when pan/zoom in/ zoom out
- GeoTIFF
- Good for grids but for raster imagery there is no effective lossy compression except JPEG = same problem as JPEG
- ECW and Mr. SID
- You need special licence to be able to save in ECW and Mr. SID - you can't do that by default with GDAL (QGIS). If you have special licence, you probably don't need to read this answer because processing imagery is your daily bread (our company usually gets imagery in ECW format from our clients)
- Database / Map server
- It is definitely good option if you have already some database / Map server running or at least know how to do it easily and fast. In that case data can be saved in GeoTIFF or whatever and are send usually as JPEG to your client - web browser or Desktop software like QGIS. But if you don't have server and want something easy to load/see imagery easily in QGIS, it is too complicated.
WHY JPEG2000:
As I have posted in my Question - GDAL provides more options to save in JPEG2000 format but as listed on GDAL website non of it should be provided in default version of GDAL. I tried probably 6 different versions of QGIS while testing and all of them had at least one JPEG2000 option (on Windows 7). To make sure I suggest to install OSGeo4W (32 or 64 bit) version of QGIS and check in OSGeo4W shell if any JPEG2000 code is available.
(on Windows just run OSGeo4W shell from start menu/programs and write there command gdal_translate --formats
or gdalwarp --formats
).
In all versions of QGIS I tried there was JP2OpenJPEG code (OpenJPEG library (v2)) available. And after some longer testing including others I found that one the most handy.
Advantages of JP2OpenJPEG
- free to use for open/save
- no "small" size limit (defintely can go way above 65500x65500)
- very effective compression (possible to set %)
- includes pyramids (previews) for fast viewing (also possible to set)
(options to set compression (-co QUALITY), pyramids (-co RESOLUTIONS) and some more - http://www.gdal.org/frmt_jp2openjpeg.html)
Simple example of conversion in QGIS using gdal_translate (in QGIS go to Raster/Converion/Translate, set whatever you need and possibly click on edit button to adjust the command to fit your needs):
gdal_translate -of JP2OpenJPEG -co QUALITY=10 srcGridOrImage image.jp2
Martin, I had the same problem, very frustrating!
What worked for me was compiling my own version of the rgdal package using my local system's version of GDAL and PROJ4 as Loic Dutrieux's suggested. If you've installed GDAL using KyngChaos packages you should be able to do so by executing the following command in R:
install.packages("rgdal", type = "source", configure.args="--with-gdal-config=/Library/Frameworks/GDAL.framework/unix/bin/gdal-config --with-proj-include=/Library/Frameworks/PROJ.framework/unix/include --with-proj-lib=/Library/Frameworks/PROJ.framework/unix/lib --with-proj-share=/Library/Frameworks/PROJ.framework/unix/share/proj --with-proj-data=/Library/Frameworks/PROJ.framework/unix/share/proj --with-data-copy=yes")
If you do not yet have a separate install of GDAL on your system (check by running 'gdalinfo --version' in a MacOS terminal), you will have to download and install the 'GDAL Complete' framework from KyngChaos first: http://www.kyngchaos.com/software/frameworks
I ran into trouble with various versions of GDAL on my system and was unable to compile the package, so I ended up starting with a clean install of R, GDAL and all associated packages. Then it worked. Hopefully, this won't be needed in your case!
--
UPDATE: To ensure the home-build rgdal package works like the binaries on CRAN, the GDAL and PROJ4 data files need to be included. I have updated the line of code above with two additional arguments.
Best Answer
JPEG2000 does support transparency. See the GDAL file formats documentation here. Also see the relevant wiki page and not the 'side channel spatial information' section.