GDAL, MrSid, and nearblack

Translating MrSid lossy compressed files into uncompressed imagery has its drawbacks, including licensing and artifacts.
Old versions of fwtools, which includes the GDAL utilities (and more), were compiled with a license that allowed for the translation of MrSid into e.g. Erdas Imagine images or GeoTiff. The licensing changed on that library, so FWTools and MS4W don’t do this anymore.

If you have a compiled version of the GDAL utilities with a legal license for converting, you still run into the issue of artifacts, e.g.

Nearly, but not quite black pixels at the edge of MrSid lossy compressed image

GDAL’s nearblack is a great utility for correcting this problem. If we wanted to batch this up on a windows system, it might look something like this:


FOR %f IN (*.sid) DO nearblack -o %~nf.img %f

5 thoughts on “GDAL, MrSid, and nearblack

  1. Actually, I should say more precisely that the artifacts are native to the lossy compressed imagery, and translation into a non-lossy format does not remove them, hence the term “lossy”.

    1. Is there actually anyway to get rid of these artifacts? I have the same problem with ecw files and am trying to remove them with all kinds of tools but I can´t find any way to remove them

  2. Hmm, didn’t work as well as expected. Not sure if it’s a misread of the MrSid file, or a problem with running nearblack directly on a MrSid, but it might be safer to run gdal_translate first, maybe output to VRT to avoid using too much space.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.