ZBar
ZBar is open-source software for reading bar codes. It appears to be abandoned but is still useful in certain circumstances.
As of version 0.10, the Windows port of ZBar is still in testing and only contains libraries & command-line programs, not the graphical interface. zbarimg.exe
, which is very useful for scripting, is installed to %PROGRAMFILES(x86)%\ZBar\bin\
.
Packages
ZBar 0.10
The current Windows release of ZBar contains a buggy build of ImageMagick and lacks clear instructions for recompiling it. If you need to use it with file formats that can't be read without external helper programs (delegates), you'll need to install these helpers and deploy an application compatibility database to work around the bugs that prevent ZBar from even running them.
By way of example, to read DNGs, it will need:
- UFRaw
- An application-compatibility database specifying that
zbarimg.exe
should use theCorrectFilePaths
shim with the command line+Win9xPath "c:\usr\bin\ufraw-batch;%PROGRAMFILES(X86)%\UFRaw\bin\ufraw-batch.exe" "/usr/bin/ufraw-batch;%PROGRAMFILES(x86)%\UFRaw\bin\ufraw-batch.exe"
- A fix to read from the right temporary file. One of:
- Figure out how to convince libmagick as packaged with ZBar to read from
delegates.xml
. I have not succeeded in doing this. - Figure out how to get ZBar to use a new upstream libmagick.
- Deploy a binary patch for
libMagickCore-2.dll
. At address0x001e4d14
, change6e 6d
to6d 26
. This patch can be deployed with bsdiff, or you can deploy the full fixed file.
- Figure out how to convince libmagick as packaged with ZBar to read from
This seems like a lot of work, but if you absolutely have to write a script that will read bar codes from DNGs, this will let you do it.
<?xml version="1.0" encoding="UTF-8"?>
<packages:packages
xmlns:packages="http://www.wpkg.org/packages" xmlns:wpkg="http://www.wpkg.org/wpkg" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.wpkg.org/packages ../xsd/packages.xsd" >
<package
id="zbar"
name="ZBar"
revision="%version%"
reboot="false"
priority="0">
<depends package-id="appcompat_zbar" />
<variable name="version" value="0.10" />
<check type="uninstall" condition="versiongreaterorequal" path="ZBar Bar Code Reader" value="%version%" />
<check type="file" condition="versiongreaterorequal" path="%PROGRAMFILES%\ZBar\bin\zbarimg.exe" value="%version%" architecture="x86" />
<check type="file" condition="versiongreaterorequal" path="%PROGRAMFILES(x86)%\ZBar\bin\zbarimg.exe" value="%version%" architecture="x64" />
<install cmd='"%SOFTWARE%\zbar\zbar-%version%-setup.exe" /S' />
<!-- install binary-patched DLL -->
<install cmd='"%COMSPEC%" /C copy /y "%SOFTWARE%\zbar\libMagickCore-2-patched.dll" "%PROGRAMFILES(x86)%\ZBar\bin\libMagickCore-2.dll"' architecture="x64" />
<install cmd='"%COMSPEC%" /C copy /y "%SOFTWARE%\zbar\libMagickCore-2-patched.dll" "%PROGRAMFILES%\ZBar\bin\libMagickCore-2.dll" architecture="x86" />
<upgrade include="install" />
<remove cmd='"%PROGRAMFILES%\ZBar\uninstall.exe" /S' architecture="x86" />
<remove cmd='"%PROGRAMFILES(x86)%\ZBar\uninstall.exe" /S' architecture="x64" />
</package>
<package id="appcompat_zbar"
name="ZBar application compatibility fix"
revision="%PKG_VERSION%"
reboot="false"
priority="2">
<variable name="PKG_VERSION" value="1"/>
<variable name="PKG_SDB" value="zbar.sdb" />
<variable name="PKG_GUID" value="{f41222ce-b4f4-4648-a499-7680f512daa7}" />
<variable name="PKG_LONGNAME" value="ZBar Application Compatibility" />
<!-- See http://technet.microsoft.com/en-us/library/cc749586%28v=ws.10%29.aspx
and http://technet.microsoft.com/en-us/library/cc749169%28v=ws.10%29.aspx -->
<!-- Add checks for all your SDBs here. Get the GUIDs by looking at the
database in the Application Compatibility Administrator.
32-bit fixes appear in %WINDIR%\appatch\custom
64-bit fixes appear in %WINDIR%\appatch\custom\Custom64
-->
<check type="registry" condition="exists" path="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\InstalledSDB\%PKG_GUID%" />
<check type="uninstall" condition="exists" path="%PKG_LONGNAME%" />
<!-- Now install your SDBs with sdbinst -->
<install cmd="sdbinst "%SOFTWARE%\zbar\%PKG_SDB%" -q"/>
<upgrade include="install"/>
<remove cmd="sdbinst -g "%PKG_GUID""/>
</package>
</packages:packages>