weird pixels on the border of transparent areas
massimo
Global Mapper UserTrusted User
Hello.
I have some jp2000 files with some areas set to transparent within them (created with Global Mapper). When load one such jp2000 and try to export a subset of the image (png or jp2000 still with transparency) I have some weird pixel set to the background color just on the border of transparent areas.
These pixel are not visible on the original file. The problem get worse every other iteration of the process.
I'm attaching an example of the result.
Any idea of the reason for that?
Thanks and regards,
Massimo
I have some jp2000 files with some areas set to transparent within them (created with Global Mapper). When load one such jp2000 and try to export a subset of the image (png or jp2000 still with transparency) I have some weird pixel set to the background color just on the border of transparent areas.
These pixel are not visible on the original file. The problem get worse every other iteration of the process.
I'm attaching an example of the result.
Any idea of the reason for that?
Thanks and regards,
Massimo
Comments
-
I'm using version 11 (build March 2, 2010)....
-
How are you setting up the transparency? It looks like you are getting artifacts caused by the lossy nature of JPEG2000 files around the borders of your data. You would see those if you were setting transparency using a particular color or something.
Also, can you try getting the latest build in case that helps? I have placed a new build at http://www.globalmapper.com/global_mapper11.zip with the latest changes for you to try. Simply download that file and extract the contents into your existing v11.xx installation folder to give it a try. If you are using the 64-bit version, there is a new build available at http://www.globalmapper.com/global_mapper11_64bit.zip .
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
I'm setting transparency using BG_TRANSPARENT="YES" and so getting transparent areas from the source files (jpeg2000). I will try the new build, what I do not understand is why these effects are not evident in the source file if they are related on the lossy nature of jpeg2000...
Thanks and Regards,
Massimo -
Massimo,
If you still have trouble with the new build, can you provide the original JPEG2000 file that you are exporting from so that I can take a look?
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Massimo,
I just tried loading your JP2 file and exporting to both 8-bit and 24-bit PNG files and in both cases they came out fine with no artifacts (I've attached my results). Can you provide the script that you are using to export?
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
I think they only "appear" to be good, but if you change the background color you will see the artifacts.. at least it is what happen on my pc..
-
Ah sorry, you are right, I do see the problems when I change the background color.
I delved into this and found the issue in the JP2 file. The fuzzy areas in the PNG file are all places where the original JP2 file had a very small, but non-zero, alpha value. The alpha value in the source JP2 file is very small (like 1, the minimum non-transparent value), but that is enough to make it a valid pixel vs. a completely transparent one. The PNG export from Global Mapper only stores either completely transparent (alpha = 0) or completely opaque (alpha = 255), so those very faint pixels are turned to full color pixels on export to PNG with a color nearly identical to the background color.
Where did you get the JP2 file that you are loading?
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Hello, thanks for your time.
The jp2 I have uploaded yesterday was created with Global Mapper (made with the latest build just before uploading it). I loaded a geotiff without transparency and a shapefile to be used as a crop mask for the visible area when exporting the jp2 with transparency. Since the small values on the alpha channel are probably unavoidable on the jp2 file (given the lossy compression of the format) is there a way to save this small values of alpha channel also on the png format? As far as I know about png it should be able to store any percentage of partial transparency..
Massimo -
Make sure you also have resampling set to nearest neighbor at every stage in the process. That might help a little. PNG format should avoid this issue since it's not lossy. But you might first have to load the PNG file with Photoshop, select the color range that you want to be transparent, then expand selection by one pixel and delete out the new selection.
I don't think you'll find an easy answer to problem. It's inherent with using lossy image formats and transparency. If you find better solution, let me know. -
Massimo,
I had thought that the lossiness for JP2 files didn't apply to the alpha channel, but I guess I was wrong! I have updated the JP2/ECW reader in Global Mapper to treat any very small alpha values (i.e. smaller than 8) as completely transparent, which should then carry over to the PNG export. I have placed a new build at http://www.globalmapper.com/global_mapper11.zip with the change for you to try. Simply download that file and extract the contents into your existing v11.xx installation folder to give it a try. If you are using the 64-bit version, there is a new build available at http://www.globalmapper.com/global_mapper11_64bit.zip .
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
ok! it works.. I still have some incorrect pixels but now they are negligible..
Thanks a lot!
Massimo
Categories
- 12.7K All Categories
- 5.6K Features Discussion
- 342 Downloading Imagery
- 1.3K Elevation Data
- 380 Georeferencing Imagery Discussion
- 628 GM Script Language
- 53 User Scripts
- 113 GPS Features
- 414 Projection Questions
- 819 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 177 Announcement and News
- 908 Bug Report
- 558 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 562 Other Discussion
- 129 GIS Data Sources
- 27 Global Mapper Showcase
- 233 How I use Global Mapper
- 107 Global Mapper Forum Website