Changes

Jump to: navigation, search

ZBar

3,276 bytes added, 22:01, 17 March 2015
Notes on the horror of getting zbar to work with obscure file formats.
[http://zbar.sourceforge.net/ 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. <code>zbarimg.exe</code>, which is very useful for scripting, is installed to <code>%PROGRAMFILES(x86)%\ZBar\bin\</code>.
=== 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 [[Microsoft Application Compatibility Toolkit|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 [[Microsoft Application Compatibility Toolkit|application-compatibility database]] specifying that <code>zbarimg.exe</code> should use the <code>CorrectFilePaths</code> shim with the command line <code>+Win9xPath "c:\usr\bin\ufraw-batch;%PROGRAMFILES(X86)%\UFRaw\bin\ufraw-batch.exe" "/usr/bin/ufraw-batch;%PROGRAMFILES(x86)%\UFRaw\bin\ufraw-batch.exe"</code>
* A fix to read from the right temporary file. One of:
** Figure out how to convince libmagick as packaged with ZBar to read from <code>delegates.xml</code>. I have not succeeded in doing this.
** Figure out how to get ZBar to use a new upstream libmagick.
** Deploy a binary patch for <code>libMagickCore-2.dll</code>. At address <code>0x001e4d14</code>, change <code>6e 6d</code> to <code>6d 26</code>. This patch can be deployed with [http://www.daemonology.net/bsdiff/ bsdiff], or you can deploy the full fixed file.
 
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.
<source lang="xml">
reboot="false"
priority="0">
 
<depends package-id="appcompat_zbar" />
<variable name="version" value="0.10" />
<install cmd='"%SOFTWARE%\zbar\zbar-%version%-setup.exe" /S' />
 
<!-- install binary-patched DLL -->
<install cmd='cmd.exe /C copy /y "%SOFTWARE%\zbar\libMagickCore-2-patched.dll" "%PROGRAMFILES(x86)%\ZBar\bin\libMagickCore-2.dll" architecture="x64" />
<install cmd='cmd.exe /C copy /y "%SOFTWARE%\zbar\libMagickCore-2-patched.dll" "%PROGRAMFILES%\ZBar\bin\libMagickCore-2.dll" architecture="x86" />
<upgrade include="install" />
</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 &quot;%SOFTWARE%\zbar\%PKG_SDB%&quot; -q"/>
<upgrade include="install"/>
 
<remove cmd="sdbinst -g &quot;%PKG_GUID&quot;"/>
</package>
 
</packages:packages>
91
edits

Navigation menu