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.
Convert -resize but keep channel depth for blue at 2 bits
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Convert -resize but keep channel depth for blue at 2 bits
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)
Depth: 8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 2-bit
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
Code: Select all
identify -verbose rose.png
Channel depth:
red: 8-bit
green: 8-bit
blue: 2-bit
Re: Convert -resize but keep channel depth for blue at 2 bits
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.
My primary goal was to have a lesser resolution image with a smaller file size for web use.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Convert -resize but keep channel depth for blue at 2 bits
For PNG files, I suggest you use the pngcrush program.cpc664 wrote:My primary goal was to have a lesser resolution image with a smaller file size for web use.
snibgo's IM pages: im.snibgo.com
Re: Convert -resize but keep channel depth for blue at 2 bits
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
#! /bin/sh
optipng -i 0 -o 7 $1
advpng -z -4 -i 50 $1