Re: convert - downscaling comic pages
Posted: 2014-08-25T13:49:10-07:00
EWA RobidouxSharp winning over orthogonal and EWA Catrom is what I expected.
Use https://github.com/ImageMagick/ImageMagick/discussions instead.
https://imagemagick.com/discourse-server/
https://imagemagick.com/discourse-server/viewtopic.php?t=25629
So for jpg's '-depth 16' and png's should be '-depth 8' on the output?NicolasRobidoux wrote:Put -depth 8 right before the output file name if you put a -depth 16 near the beginning. This tells IM that what you want from now on (and "from now on" means "for the output file" since it is just before the output file) is 8-bit per channel. Because you are using HDRI Q16, the result, by the time the result reaches the output file, was 16-bit by default (unless you use, say, JPEG, which is 8-bit). The reason the files turned out double the size is that what I gave you produces 16-bit pngs (2x8=16).
So, off the top of my head, you should have a -depth 16 at the beginning and a -depth 8 at the end.
However, if you are concerned about run time and memory use, compare the outputs (which you appear to have done), and if you don't notice anything different skipping the -depth commands, drop them because they likely have a significant impact unless the input files are small.
This being said, I'd rather have more accurate color preservation, but I'm not running on a server farm on a budget.
JPEG's should be '-depth 8' as well, but you can omit it because JPEG onlysteve___ wrote: So for jpg's '-depth 16' and png's should be '-depth 8' on the output?
That's what I thought too, but since I was giving instructions off the top of my head, I played it safe by adding a -depth 16 at the beginning.snibgo wrote:I could be wrong, but I don't think "-depth 16" (or any other number) at the start of the command will make any difference until the image is written to a file. All internal processing is done according to Q and HDRI; a depth number makes no difference.
Here is a quick test with a jpg using -depth16, -depth8, no depthNicolasRobidoux wrote:snibgo wrote: P.S. Steve: I'm pretty sure you can omit the -depth 16 at the beginning. But not the -depth 8 at the end, unless you are producing jpegs, in which case it being there won't hurt.
Code: Select all
stat -c "%s %n" convert-depth/*.* convert-depth/orig/bw-thin_line.jpg | sort -n
207734 convert-depth/RobidouxSharp-ewa-gamma1.6-nodepth-complex-web-bw-thin_line.png
208920 convert-depth/RobidouxSharp-ewa-gamma1.6-depth8-complex-web-bw-thin_line.png
220672 convert-depth/RobidouxSharp-ewa-gamma1.6-depth16-complex-web-bw-thin_line.jpg
220672 convert-depth/RobidouxSharp-ewa-gamma1.6-nodepth-complex-web-bw-thin_line.jpg
248660 convert-depth/RobidouxSharp-ewa-gamma1.6-depth8-complex-web-bw-thin_line.jpg
1114333 convert-depth/RobidouxSharp-ewa-gamma1.6-depth16-complex-web-bw-thin_line.png
1572892 convert-depth/orig/bw-thin_line.jpg
For the 16 to 8 bit png result, what do you mean by "worthwhile"? Why would it be better at 8-bits apart from the file size?NicolasRobidoux wrote:Steve:
Pretty conclusive.
-----
This is what I remember. (Anyone: correct me if I'm wrong.)
If the input image is 8-bit and you are producing a png, you'll get an 8-bit png.
If the input image is 16-bit and you are producing a png, -depth 8 may be worthwhile.
Steve cares about file size, and an 8-bit png is almost invariably going to be much smaller than a 16-bit one.fmw42 wrote: For the 16 to 8 bit png result, what do you mean by "worthwhile"? Why would it be better at 8-bits apart from the file size?
Code: Select all
convert \( input.png -set colorspace sRGB -colorspace RGB \) \
\( -clone 0 -gamma 1.666666666666666 -filter RobidouxSharp -distort Resize $res -gamma 0.6 \) \
\( -clone 0 -filter RobidouxSharp -distort Resize $res \) \
-delete 0 \
\( -clone 1 -colorspace gray -auto-level \) \
-compose over -composite \
-set colorspace RGB -colorspace sRGB \
output.png
I wasn't clear. The test above is using an 8-bit jpg. The 8-bit png'sNicolasRobidoux wrote:Steve:
Pretty conclusive.
-----
This is what I remember. (Anyone: correct me if I'm wrong.)
If the input image is 8-bit and you are producing a png, you'll get an 8-bit png.
If the input image is 16-bit and you are producing a png, -depth 8 may be worthwhile.
The more complex RobidouxSharp command is slightly better than plainfmw42 wrote:In Steve's message above, he said
"For me the favourite was Catrom-rgb-gamma1.3"
but I am not sure if that was before testing with RobidouxSharp or not.
Steve, have you come to some conclusion?
In what way? Can you post one to show us what is happening and the command line you used?The 8-bit png's are not useable, they are distorted
Here are the tests I posted earlier:fmw42 wrote:In what way? Can you post one to show us what is happening and the command line you used?The 8-bit png's are not useable, they are distorted
Are you running Q16 or Q8 IM?
Code: Select all
convert \( "$f[0]" -quiet -set colorspace sRGB -colorspace RGB \) \
\( -clone 0 -gamma 1.666666666666666 -filter "$filter" -distort Resize $res -gamma 0.6 \) \
\( -clone 0 -filter "$filter" -distort Resize $res \) \
-delete 0 \
\( -clone 1 -colorspace gray -auto-level \) \
-compose over -composite \
-set colorspace RGB -colorspace sRGB -depth 8 +repage \
outfile
Code: Select all
$ convert -version
Version: ImageMagick 6.8.8-5 Q16 x86_64