[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: saving a NxM matrix as a color-mapped image of size NxM
From: |
James Sherman Jr. |
Subject: |
Re: saving a NxM matrix as a color-mapped image of size NxM |
Date: |
Wed, 12 Dec 2012 09:16:02 -0500 |
On Wed, Dec 12, 2012 at 7:44 AM, <address@hidden> wrote:
> Dear James,
>
>
> Many thanks for Your hint.
> On 11/12/12 16:45:18, James Sherman Jr. wrote:
>> I think the problem is that your original image (mHist2d) is of type
>> double, but imwrite expects type uint8, so what happens if you try:
>>
>> imwrite(uint8(mHist2d), colormap(cmap), "test.png", "png");
>
> True. It seems that the hist values have to be between [1;256] and only
> [1;256] from cmap are used.
> Attached is a small test script in case someone has the same problem.
>
> Many thanks again
> Lynx
>
>
Well, its not specifically tied to imwrite (I oversimplified in my
original message). I believe its more specific to your version of
graphicsmagik (where the error message came from). My graphicsmagik
on my machine can work with 16bit, so (if needed for whatever reason)
I can do 16 bit. Since yours is 8 bit, it can only handle 2^8 = 256
colors.