Hi All,
I am new to imagemagik. I have a query while using it. The scenario is as follows.
I have a 24 bit png.
http://wikisend.com/download/816040/image_5778.png
I want to convert it to 4 bit png. I tried the following command
convert image_5778.png PNG8:correctimage.png This is successfully converting 24 bit to 8 bit png, but when I tried
convert image_5778.png -depth 4 correctimage.png It is not getting converted to 4 bit png.
Please let me know how I can save it correctly to 4 bit for my use and what is wrong in the command I used.
Note: I am using ImageMagick-6.8.7-Q16 in Windows machine.
Converting a 24 bit png to 4 bit png not successfull
-
- Posts: 3
- Joined: 2013-12-03T06:16:58-07:00
- Authentication code: 6789
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Converting a 24 bit png to 4 bit png not successfull
I think you are confusing 24 bits per pixel and 8 bits per channel per pixel.
Your input image has pixeldepth 24 (bits per pixel). But there are only 2 colours: black and white.
After this command ...
... the result has 2 palette entries, with pixeldepth of 1.
IM generally tries to make the file as small as possible. You can force it to be 24-bits (per pixel) with PNG24:out.png but I don't think you can force 4-bits/channel/pixel.
Your input image has pixeldepth 24 (bits per pixel). But there are only 2 colours: black and white.
After this command ...
Code: Select all
convert image_5778.png i.png
IM generally tries to make the file as small as possible. You can force it to be 24-bits (per pixel) with PNG24:out.png but I don't think you can force 4-bits/channel/pixel.
snibgo's IM pages: im.snibgo.com
Re: Converting a 24 bit png to 4 bit png not successfull
Yes, the converted image has a palette with two entries, black and white. This should be representable without loss
as a 4-bit image. I don't know why convert is rejecting the attempt to write the 1-bit image in a 4-bit format. I'll
take a look at that.
as a 4-bit image. I don't know why convert is rejecting the attempt to write the 1-bit image in a 4-bit format. I'll
take a look at that.
Re: Converting a 24 bit png to 4 bit png not successfull
It turns out to be a side effect of the recent split of linear and sRGB colorspaces. A fix is in the SVN repository, r=13919 and will appear in IM-6.8.7-9 in a few days.
-
- Posts: 3
- Joined: 2013-12-03T06:16:58-07:00
- Authentication code: 6789
Re: Converting a 24 bit png to 4 bit png not successfull
Thanks for the inputs. So if I understand correctly, I will be able to test this only when IM-6.8.7-9 gets released. Please let me know once it gets released.
I am waiting for it.
I am waiting for it.
-
- Posts: 3
- Joined: 2013-12-03T06:16:58-07:00
- Authentication code: 6789
Re: Converting a 24 bit png to 4 bit png not successfull
Glen,
Can you please try converting the attached image to 4 bit using the development version of Imagemagick and share it here. It is for a urgent project requirement. Any help will be appreciated.
Can you please try converting the attached image to 4 bit using the development version of Imagemagick and share it here. It is for a urgent project requirement. Any help will be appreciated.
Re: Converting a 24 bit png to 4 bit png not successfull
Using this command:prasadmenon wrote:Glen,
Can you please try converting the attached image to 4 bit using the development version of Imagemagick and share it here. It is for a urgent project requirement. Any help will be appreciated.
Code: Select all
convert image_5778.png -define png:color-type=0 -define png:bit-depth=4 -define png:exclude-chunks=all image_depth4.png
Re: Converting a 24 bit png to 4 bit png not successfull
This bug was fixed in IM-6.8.7-9 but has reappeared in IM-6.9.1-3.