I have seen something like this question in a few other places around the site.
I need to convert a folder of pngs to 8-bit.
convert original.png -auto-level -depth 8 -define quantum:format=unsigned -type grayscale test.png
works for an individual photo,
and I tried mogrify -format png -depth 8 *.png on the directory but I don't think it worked. Both of those commands I found on other topics. Anyone have any idea how to use mogrify (i assume) to make all of these images 8-bit?
Convert entire folder to 8-bit
Convert entire folder to 8-bit
Last edited by acoustic7 on 2013-08-13T13:59:11-07:00, edited 1 time in total.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Confert entire folder to 8-bit
You need the png equivalent of this -define to be able to set the output in mogrify to PNG8 (PNG24 and PNG32). viewtopic.php?f=1&t=23875#p101575
I have suggested it already to the png developer, but have not heard back. Perhaps it will make it into the next version of IM, if he has not already done so.
In the mean time, try adding -type palette and or -colors 255 rather than grayscale in your mogrify command. That may work already. I do not think the quantumformat is something that either mogrify or PNG knows about. So it is likely useless.
I have suggested it already to the png developer, but have not heard back. Perhaps it will make it into the next version of IM, if he has not already done so.
In the mean time, try adding -type palette and or -colors 255 rather than grayscale in your mogrify command. That may work already. I do not think the quantumformat is something that either mogrify or PNG knows about. So it is likely useless.
Last edited by fmw42 on 2013-08-13T14:01:28-07:00, edited 2 times in total.
Re: Confert entire folder to 8-bit
try "-colors 255" which should give you an 8-bit indexed PNG.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Convert entire folder to 8-bit
What do you mean? 8 bits per pixel per channel, or 8 bits total per pixel?acoustic7 wrote:I need to convert a folder of pngs to 8-bit.
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Convert entire folder to 8-bit
8-bits total (that is type palette using a color map)
if you want 8bits per channel and are using Q16 IM compile, then -depth 8 should be enough.
if you want 8bits per channel and are using Q16 IM compile, then -depth 8 should be enough.
Re: Convert entire folder to 8-bit
Thank you all for the responses!
I tried a sort of hybrid of the two commands before seeing these responses and it seems to have worked. For anyone curious, I did:
mogrify -format png -auto-level -depth 8 -define quantum:format=unsigned -type grayscale *.png
and as I said, it seems to have worked.
Thanks for the other suggestions though, I'm going to have to do this with some more images in the future, and chances are good that they won't work with the same command that these did, so -color255 and-type palette will probably come in handy.
thank you!!
I tried a sort of hybrid of the two commands before seeing these responses and it seems to have worked. For anyone curious, I did:
mogrify -format png -auto-level -depth 8 -define quantum:format=unsigned -type grayscale *.png
and as I said, it seems to have worked.
Thanks for the other suggestions though, I'm going to have to do this with some more images in the future, and chances are good that they won't work with the same command that these did, so -color255 and-type palette will probably come in handy.
thank you!!
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Convert entire folder to 8-bit
I had missed the fact that this is greyscale, so there is only one channel. Hence "bits per pixel" and "bits per channel per pixel" are the same.
snibgo's IM pages: im.snibgo.com