3

I'm running into an issue georeferencing a number of PNG image files. The files simply contain an image where each pixel is either transparent or a single color, forming a coverage mask. In the past, when I've georeferenced these images, the 'use 0 for transparency' checkbox masked off the transparent parts of the images and I was able to polygonize the colored parts. However, with a number of images in a recent patch QGIS will simply not mask off the transparent sections. I've opened the files with an image editor and resaved them to no effect, so it's not a formatting problem with the input png.

I can somewhat work around this by setting the value of the transparent section to the no data value, thus masking off the image in the raster layer. However, when I polygonize the raster, the no data value still gets polygonized into the .shp file.

How do I polygonize the raster and specify only the single band I want to polygonize?

  • if this worked before, then please file a bug report at hub.qgis.org/issues , preferably with one of these PNG images to test with. Also note the last version you remember where it still worked. – lynxlynxlynx Jul 6 '12 at 15:18
  • @lynxlynxlynx -- that's the odd thing, I've got some of the old png files and they /still do/ import properly, though I can't find any real difference between the files. They're both two-color PNGs, every pixel is either transparent or red. However, QGIS pulls the transparency pixels from one as the data and the red pixels from the other as the data. I updated from 1.7.3 to 1.8.0 to try to resolve it, which didn't have any effect, – Oesor Jul 6 '12 at 15:28
  • 1
    Still sounds like a bug or at least something the devs would like to know about. – lynxlynxlynx Jul 6 '12 at 19:37
1

Issues with georeferencing aside, I can just delete the polygons once polygonized by:

  1. Toggle editing on on the layer
  2. Select all of the unwanted polygons with a search in the attribute table
  3. Delete the selected polygons
  4. Toffle off editing and save the resulting shapefile when prompted

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.