Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 426352 - app-text/htmldoc-1.8.27-r3 does not render PNGs properly
Summary: app-text/htmldoc-1.8.27-r3 does not render PNGs properly
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: Normal normal (vote)
Assignee: No maintainer - Look at if you want to take care of it
Keywords: NeedPatch
Depends on:
Reported: 2012-07-12 18:32 UTC by Felix Steffenhagen
Modified: 2017-09-04 09:15 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---

PDF rendered by htmldoc using the Google logo (htmldoc-pngtest.pdf,98.12 KB, application/x-pdf)
2012-07-12 18:37 UTC, Felix Steffenhagen
explicitly defines 'gray' value when reading a png (htmldoc-png.patch,2.72 KB, patch)
2012-07-24 19:37 UTC, Sibren Polders
Details | Diff
ebuild that goes with htmldoc-png.patch (htmldoc-1.8.27-r3.ebuild,1.85 KB, text/plain)
2012-07-24 19:39 UTC, Sibren Polders
disable optimalizations (,336 bytes, patch)
2014-04-18 09:22 UTC, Milka
Details | Diff
ebuild for (htmldoc-1.8.27-r4.ebuild,1.87 KB, text/plain)
2014-04-18 09:26 UTC, Milka
glogo.png for testing (glogo.png,23.16 KB, image/png)
2016-04-18 08:54 UTC, Kent Fredric (IRC: kent\n) (RETIRED)

Note You need to log in before you can comment on or make changes to this bug.
Description Felix Steffenhagen 2012-07-12 18:32:41 UTC
PNG images in PDFs gnerated from HTML files using htmldoc-1.8.27-r3 are not rendered properly.

Reproducible: Always

Steps to Reproduce:
1. Install htmldoc-1.8.27-r3 and dependent packages
2. Get a PNG image (e.g. the google logo)
3. Create a simple html file that includes the PNG file. For example:
<body><img src="glogo.png"/></body>
4. Convert the html file with htmldoc to a PDF using the command
htmldoc --bottom 1cm --top 0cm --left 1cm --right 1cm --webpage --landscape test.html -f output.pdf
5. Check the resulting PDF
Actual Results:  
The rendered PNG image has wrong colors and looks pixelated.

Expected Results:  
The PNG image is rendered properly with correct colors and resolution.

output of emerge --info:

Portage (default/linux/x86/10.0, gcc-4.5.3, glibc-2.14.1-r3, 2.6.38-11-generic x86_64)
System uname: Linux-2.6.38-11-generic-x86_64-Intel-R-_Core-TM-_i5-2300_CPU_@_2.80GHz-with-gentoo-2.1
Timestamp of tree: Fri, 06 Jul 2012 22:30:01 +0000
app-shells/bash:          4.2_p20
dev-lang/python:          3.2.3
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.1-r1
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.68
sys-devel/automake:       1.11.1
sys-devel/binutils:       2.21.1-r1
sys-devel/gcc:            4.5.3-r2
sys-devel/gcc-config:     1.6
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r1
sys-kernel/linux-headers: 3.1 (virtual/os-headers)
sys-libs/glibc:           2.14.1-r3
Repositories: gentoo
CFLAGS="-O2 -march=i686 -pipe"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -march=i686 -pipe"
FCFLAGS="-O2 -march=i686 -pipe"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS="-O2 -march=i686 -pipe"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
USE="acl berkdb bzip2 cli cracklib crypt cups cxx dri fortran gdbm gpm iconv ipv6 modules mudflap ncurses nls nptl openmp pam pcre pppd readline session ssl tcpd unicode x86 xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" PHP_TARGETS="php5-3" PYTHON_TARGETS="python3_2 python2_7" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga neomagic nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Comment 1 Felix Steffenhagen 2012-07-12 18:37:45 UTC
Created attachment 318016 [details]
PDF rendered by htmldoc using the Google logo

Attached a PDF output of htmldoc showing the rendering issue using the Google logo as an example.
Comment 2 Felix Steffenhagen 2012-07-12 18:43:59 UTC
For comparison, I have also have an older gentoo environment in which I have installed htmldoc-1.8.27 and libpng-1.4.8. There, rendering works fine.
Comment 3 Pacho Ramos gentoo-dev 2012-07-23 18:38:44 UTC
It's probably due out libpng15 compatibility patch... but looks like it's the same as used in other distributions like debian, fedora or opensuse :/
Comment 4 Sibren Polders 2012-07-24 19:34:15 UTC
Had the same problem on my 32bit systems, but it worked fine on 64bit
(both having libpng1.5.10). The svn release however works fine on both.
I checked the source and noticed that in my case the gray value didn't get assigned correctly when pngs' where read. I added the patch and ebuild that worked for my 32 bit systems.
Comment 5 Sibren Polders 2012-07-24 19:37:45 UTC
Created attachment 319114 [details, diff]
explicitly defines 'gray' value when reading a png
Comment 6 Sibren Polders 2012-07-24 19:39:05 UTC
Created attachment 319116 [details]
ebuild that goes with htmldoc-png.patch
Comment 8 Pacho Ramos gentoo-dev 2013-01-01 20:24:39 UTC
(In reply to comment #7)
> Have you checked if this snapshot works ok for you?
> sourceforge/c/cy/cygwin-ports/release-2/htmldoc/htmldoc-1.9.x-r1703-1-src.
> tar.bz2

Any news here?
Comment 9 Milka 2014-04-17 07:33:06 UTC
htmldoc-1.8.27-r3 does not render PNGs properly when compiled with GCC 4.7.3 x86_64-pc-linux-gnu-4.7.3.
With x86_64-pc-linux-gnu-4.6.3 the PNG is rendered OK.
Comment 10 Milka 2014-04-18 09:22:26 UTC
Created attachment 375176 [details, diff]
disable optimalizations

When htmldoc is compiled without optimalizations it renders PNG correcly. Checked with gcc 4.6.3 and 4.7.3.
Comment 11 Milka 2014-04-18 09:26:24 UTC
Created attachment 375180 [details]
ebuild for

Here is the ebuild that applies the Makedefs patch. I.e. disables compiler optimalizations.
Comment 12 Kent Fredric (IRC: kent\n) (RETIRED) gentoo-dev 2016-04-18 08:54:10 UTC
Created attachment 431092 [details]
glogo.png for testing

If anyone can confirm this defect is present in 1.8.29 (~arch) as well?

I locally tested with the attached image, and it looks "Unusual", it looks better than the PDF linked ( But I can't rule it out as being a property of the PNG due to having a different PNG image ).

If you can confirm 1.8.29 is unchanged in behaviour from 1.8.27-r3, that will provide a good reference frame for an A:B comparison so it will be clear the problem is fixed when the patch is applied vs 1.8.29.
Comment 13 Milka 2016-04-19 08:21:01 UTC
I have tested 1.8.29 with all my PNG files that failed with 1.8.27-r3. They are rendered OK now. (amd64, gcc 4.8.5)
Comment 14 Michael Palimaka (kensington) gentoo-dev 2017-09-02 14:42:26 UTC
Per comment #13, the newer version is reported to work and is now stable so closing.