Page 1 of 1
Convert -resize but keep channel depth for blue at 2 bits
Posted: 2017-01-03T05:32:10-07:00
by cpc664
Hello,
using convert v6.8.9-9, I want to resize an image with these characteristics (source is a PNG of an Amstrad CPC screen capture) :
Colorspace: sRGB
Depth: 8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 2-bit
The result with -resize 21% -depth 8 -type palette comes with a blue channel depth of 8bit.
How can I keep a channel depth for blue at 2 bits ? Thanks.
Re: Convert -resize but keep channel depth for blue at 2 bits
Posted: 2017-01-03T10:30:16-07:00
by fmw42
You may have to resize, separate channels and set the depth as required, then combine the channels again.
This seems to work for me (unix syntax)
Code: Select all
convert rose: -depth 8 -resize 200% -separate \
\( -clone 0 -depth 8 \) \
\( -clone 1 -depth 8 \) \
\( -clone 2 -depth 2 \) \
-delete 0-2 -combine -set colorspace sRGB \
rose.png
Depth: 8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 2-bit
Re: Convert -resize but keep channel depth for blue at 2 bits
Posted: 2017-01-12T02:54:27-07:00
by cpc664
Thanks, it works but the resulting image is bigger.
My primary goal was to have a lesser resolution image with a smaller file size for web use.
Re: Convert -resize but keep channel depth for blue at 2 bits
Posted: 2017-01-12T03:34:14-07:00
by snibgo
cpc664 wrote:My primary goal was to have a lesser resolution image with a smaller file size for web use.
For PNG files, I suggest you use the pngcrush program.
Re: Convert -resize but keep channel depth for blue at 2 bits
Posted: 2017-01-12T05:47:19-07:00
by cpc664
At the moment I use a small script with optipng and advpng :
#! /bin/sh
optipng -i 0 -o 7 $1
advpng -z -4 -i 50 $1