Hello,
__magick_read__() reads 12-bit (and higher up to 16-bit) gray png images
when using imagemagick-6.3.8.
However it does not work with imagemagick-6.4.0.
The problem is in this section:
unsigned int depth = imvec[0].modulusDepth();
i = 0;
while(depth >>= 1) i++;
depth = 1 << i;
switch(depth) {
case 1:
output = read_images<boolNDArray>(imvec, frameidx,
depth);
break;
case 2:
case 4:
case 8:
output = read_images<uint8NDArray>(imvec, frameidx,
depth);
break;
case 16:
output = read_images<uint16NDArray>(imvec, frameidx,
depth);
break;
case 32:
case 64:
default:
error("Image depths bigger than 16-bit not supported");
}
In version 6.3.8, imagemagick returns a depth = 16 for a 12-bit gray
image. Now with version 6.4.0 it returns depth = 13 or some other value
up to 16. Therefore with the new version a depth = 13 will get into the
case 8: by virtue of the while loop above, and will drop valuable
information.
Here is a fix that works for the gray images I have experimented with;
don't know the impact on color images.
unsigned int depth = imvec[0].modulusDepth();
switch(depth) {
case 1:
output = read_images<boolNDArray>(imvec, frameidx,
depth);
break;
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
depth = 8;
output = read_images<uint8NDArray>(imvec, frameidx,
depth);
break;
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
depth = 16;
output = read_images<uint16NDArray>(imvec, frameidx,
depth);
break;
case 32:
case 64:
default:
error("Image depths bigger than 16-bit not supported");
}
--
Valmor
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev