[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
imwrite for double grayvalues fails (regression)
From: |
Andreas Weber |
Subject: |
imwrite for double grayvalues fails (regression) |
Date: |
Fri, 04 Oct 2013 00:12:11 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130922 Icedove/17.0.9 |
Dear maintainers,
after changeset b76b14e386b3
(http://hg.savannah.gnu.org/hgweb/octave/rev/b76b14e386b3?revcount=120)
imwrite with grayvalues in the range 0..1 produces a black image.
For example
a=repmat(linspace(0,1,200),100,1);
imwrite(a, test.png)
should give a image wich fades horizontally from black to white.
This is because (1 << bitdepth) gives an int overflow for bitdepth=32.
Should we use a long int:
const double divisor = static_cast<double>((1L << bitdepth) - 1) / MaxRGB;
or is there a better fix?
Andy
- imwrite for double grayvalues fails (regression),
Andreas Weber <=