Force higher Bit deph of png file
Force higher Bit deph of png file
Hello
I have the probelm that I need a 16x16 png file with a bitdeph of 32 Bit..
problem is convert always reduces the bit depth to 8 Bit.
(using convert -sample 16x16 icon.png target/icon_16_16.png on a 512x512 32 bit icon)
interestingly using it with larger target icons..
convert -sample 32x32 icon.png target/icon_32_32.png
convert -sample 48x48 icon.png target/icon_48_48.png
has 32 Bit icons as result.
What can I do to get a 32 Bit 16x16 png icon?
I have the probelm that I need a 16x16 png file with a bitdeph of 32 Bit..
problem is convert always reduces the bit depth to 8 Bit.
(using convert -sample 16x16 icon.png target/icon_16_16.png on a 512x512 32 bit icon)
interestingly using it with larger target icons..
convert -sample 32x32 icon.png target/icon_32_32.png
convert -sample 48x48 icon.png target/icon_48_48.png
has 32 Bit icons as result.
What can I do to get a 32 Bit 16x16 png icon?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Force higher Bit deph of png file
Probably need to recompile IM at Q32
Also your syntax is old. Should be
convert input -scale 16x16 output
see http://www.imagemagick.org/Usage/basics/#why
Also your syntax is old. Should be
convert input -scale 16x16 output
see http://www.imagemagick.org/Usage/basics/#why
Re: Force higher Bit deph of png file
hmpf I need to recompile the program to solve my problem?
this sounds strange
at Q32?
what do you mean with that?
I will use different syntax in future... though I assume that my current problem is not due to the syntax..
Is there really no easier way than recompiling?
I am a more or less stupid ubuntu user not accustomed to that.. recompiling programs... recompiling kernel or recompiling what ever is usually beyond ultima ratio for me.
this sounds strange
at Q32?
what do you mean with that?
I will use different syntax in future... though I assume that my current problem is not due to the syntax..
Is there really no easier way than recompiling?
I am a more or less stupid ubuntu user not accustomed to that.. recompiling programs... recompiling kernel or recompiling what ever is usually beyond ultima ratio for me.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Force higher Bit deph of png file
Again, I will defer to the IM experts. But I believe that IM is compiled for different bit depths or Q values for quantumranges: 8, 16, 32 and HDRI. You can get binaries for 8 or 16 (window) and nominally 16 for the other platforms or compile from source at any level you want on any platform. The resulting processed images are generally limited to that bit depth as the max you can get. You can specify lower using -depth. For example on Q16, you can specify -depth 8.
But you can try setting the depth to 32 and the tiff format to store it as discussed at http://www.imagemagick.org/Usage/formats/#tiff
convert image -depth 32 -define quantum:format=floating-point output.tiff
But I cannot say if that will work.
Hopefully you will get a better answer from Magick or Anthony.
But you can try setting the depth to 32 and the tiff format to store it as discussed at http://www.imagemagick.org/Usage/formats/#tiff
convert image -depth 32 -define quantum:format=floating-point output.tiff
But I cannot say if that will work.
Hopefully you will get a better answer from Magick or Anthony.
Re: Force higher Bit deph of png file
Though if that was the problem why are then the larger images in 32 bit?
There seems to be no problem creating images in 32 Bit..
I would just assume that a 16x16 pixel image might due to the little ammount of pixels not make use of 32 Bit colour range so its automagically scaled down to 8 Bit..
about storing it in tiff..
I think I really need png as I want to use theses icons with icontool to create a .ico file with 6 icons..
16x16,32x32,48x48 each in 8 and 32 bit...
There seems to be no problem creating images in 32 Bit..
I would just assume that a 16x16 pixel image might due to the little ammount of pixels not make use of 32 Bit colour range so its automagically scaled down to 8 Bit..
about storing it in tiff..
I think I really need png as I want to use theses icons with icontool to create a .ico file with 6 icons..
16x16,32x32,48x48 each in 8 and 32 bit...
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Force higher Bit deph of png file
Back off one moment.
By 32 bit PNG image what do you mean?
Do you mean 32 bit values, or 32 bit color????
32 bit colors is 8 bit red, 8 bit green, 8 bit blue and 8 bit alpha
8+8+8+8 => 32 bit colors but at 8 bit depth or quality!
This is typically what is meant by 32 bit images and IM will generate 32 bit images by default if transparency is present.
If no transparency is present it by default generates 24 bit color images.
You can force 32 bit color images using PNG32:image.png to make "image.png" a PNG 32 bit color image format.
If you mean 32 bit color values. I am not certain IM can do this, and definatally not without being recompiled to use 32 bit values in memory (Q32 or 32 bit quality). I am not even certain PNG can generate 32 bit depth/quality images!
I suggest you go and figure out what you mean first, then report back here.
For more information on this see IM Examples, Basic Usage, Quality and Depth
By 32 bit PNG image what do you mean?
Do you mean 32 bit values, or 32 bit color????
32 bit colors is 8 bit red, 8 bit green, 8 bit blue and 8 bit alpha
8+8+8+8 => 32 bit colors but at 8 bit depth or quality!
This is typically what is meant by 32 bit images and IM will generate 32 bit images by default if transparency is present.
If no transparency is present it by default generates 24 bit color images.
You can force 32 bit color images using PNG32:image.png to make "image.png" a PNG 32 bit color image format.
If you mean 32 bit color values. I am not certain IM can do this, and definatally not without being recompiled to use 32 bit values in memory (Q32 or 32 bit quality). I am not even certain PNG can generate 32 bit depth/quality images!
I suggest you go and figure out what you mean first, then report back here.
For more information on this see IM Examples, Basic Usage, Quality and Depth
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Force higher Bit deph of png file
Transparency is present.
hmm best is I show you everything.. maybe I screwed up somewhere else..
I am using the following script to create my icons..
So if I use
icotool -l icon.ico
to see what icons were created I get the following:
--icon --index=1 --width=16 --height=16 --bit-depth=8 --palette-size=256
--icon --index=2 --width=16 --height=16 --bit-depth=8 --palette-size=256
--icon --index=3 --width=32 --height=32 --bit-depth=8 --palette-size=256
--icon --index=4 --width=32 --height=32 --bit-depth=32 --palette-size=0
--icon --index=5 --width=48 --height=48 --bit-depth=8 --palette-size=256
--icon --index=6 --width=48 --height=48 --bit-depth=32 --palette-size=0
See one icon is faulty.. as there are only 2 icons and not 3 with 32 bit depth..
here is a link to a zip file containing all icons involved:
http://www.materialordner.de/1ZMQ0GrBQq ... kWOAL.html
hmm best is I show you everything.. maybe I screwed up somewhere else..
I am using the following script to create my icons..
Code: Select all
#!/bin/sh
# script for creating ico file with the 6 diffrent images rcp needs
# using single png file called icon.png as source
rm -rf target
mkdir target
# create images for different sizes
convert -sample 16x16 icon.png target/icon_16_16.png
convert -sample 32x32 icon.png target/icon_32_32.png
convert -sample 48x48 icon.png target/icon_48_48.png
# Workaround because image magick doesn't seem to reduce colors when
# converting from png to png
convert -colors 256 target/icon_16_16.png target/tmp.gif
convert -colors 256 target/tmp.gif target/icon_16_16_8bit.png
convert -colors 256 target/icon_32_32.png target/tmp.gif
convert -colors 256 target/tmp.gif target/icon_32_32_8bit.png
convert -colors 256 target/icon_48_48.png target/tmp.gif
convert -colors 256 target/tmp.gif target/icon_48_48_8bit.png
# Copy images
#cp -f icon_16_16.png target
#cp -f icon_32_32.png target
#cp -f icon_48_48.png target
icotool -c target/icon_16_16_8bit.png target/icon_16_16.png \
target/icon_32_32_8bit.png target/icon_32_32.png \
target/icon_48_48_8bit.png target/icon_48_48.png \
> target/icon.ico
icotool -l icon.ico
to see what icons were created I get the following:
--icon --index=1 --width=16 --height=16 --bit-depth=8 --palette-size=256
--icon --index=2 --width=16 --height=16 --bit-depth=8 --palette-size=256
--icon --index=3 --width=32 --height=32 --bit-depth=8 --palette-size=256
--icon --index=4 --width=32 --height=32 --bit-depth=32 --palette-size=0
--icon --index=5 --width=48 --height=48 --bit-depth=8 --palette-size=256
--icon --index=6 --width=48 --height=48 --bit-depth=32 --palette-size=0
See one icon is faulty.. as there are only 2 icons and not 3 with 32 bit depth..
here is a link to a zip file containing all icons involved:
http://www.materialordner.de/1ZMQ0GrBQq ... kWOAL.html
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Force higher Bit deph of png file
Okay your want both 32 bit color images. As well as images with a 8 bit pallete. BOTH images format are 8 bit depth, but very different images types.
First forget the excursion to GIF format. It is not needed.
For 8 bit pallette PNG use PNG8 output format
Second, using -sample is a HORIBLE way to do resizing, and it may be that the resulting image had lesst than 256 colors so IM decided that the PNG may as well be PNG8 internal format.
And finally. IM version handling is
Read the image FIRST, then operate on the image
you have the other way around, which is asking for trouble when IM v7 started to be worked on. Legacy handling will most likely cause an error!
OH. One more thing.. You don't need to use separate commands to save multiple images...
The final null: causes the command not to do the final 'write image' as it has already writes the image 6 times in 6 different ways.
The above is covered in IM examples, "Basics, Parenthesis", most of "File Formats", and PNG format notes in "Command File Formats".
Especially look at Writing an Image, Multiple Times and PNG Output Formats
First forget the excursion to GIF format. It is not needed.
For 8 bit pallette PNG use PNG8 output format
Second, using -sample is a HORIBLE way to do resizing, and it may be that the resulting image had lesst than 256 colors so IM decided that the PNG may as well be PNG8 internal format.
And finally. IM version handling is
Read the image FIRST, then operate on the image
you have the other way around, which is asking for trouble when IM v7 started to be worked on. Legacy handling will most likely cause an error!
OH. One more thing.. You don't need to use separate commands to save multiple images...
Code: Select all
convert icon.png \
\( +clone -resize 16x16\! \
-write PNG32:target/icon_16_16.png \
-write PNG8:target/icon_16_16_8bit.png +delete \) \
\( +clone -resize 32x32\! \
-write PNG32:target/icon_32_32.png \
-write PNG8:target/icon_32_32_8bit.png +delete \) \
\( +clone -resize 48x48\! \
-write PNG32:target/icon_48_48.png \
-write PNG8:target/icon_48_48_8bit.png +delete \) \
null:
The above is covered in IM examples, "Basics, Parenthesis", most of "File Formats", and PNG format notes in "Command File Formats".
Especially look at Writing an Image, Multiple Times and PNG Output Formats
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Force higher Bit deph of png file
it would be nice to be able to do this under Windows also, where backslash doesn't work for breaking long lines. Do you know a way of doing this under Windows batch files?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Force higher Bit deph of png file
I recommend you spend some time reading Anthony's Example pages. There is much to learn or find there. See http://www.imagemagick.org/Usage/
With regard to using Windows, most things can be done in batch scripts (although I am no Windows expert) but there are notes at http://www.imagemagick.org/Usage/api/#windows. In particular you replace \( with just (. Also to do an escape you use ^ rather than \.
With regard to using Windows, most things can be done in batch scripts (although I am no Windows expert) but there are notes at http://www.imagemagick.org/Usage/api/#windows. In particular you replace \( with just (. Also to do an escape you use ^ rather than \.
Re: Force higher Bit deph of png file
I'm having the opposite problem.
The following produces a PNG with 48-bit depth (!).
If I "identify input.png", I get:
Which is incorrect, since Photoshop tells me this image is 24-bit, not 8-bit.
And if I "identify output.png", I get:
Which is also incorrect, since Photoshop tells me this image is 48-bit, not 16-bit.
So I'm not sure what's going on here...
Can anyone help me?
The following produces a PNG with 48-bit depth (!).
Code: Select all
convert input.png -depth 24 output.png
Code: Select all
input.png PNG 239x320 239x320+0+0 8-bit DirectClass 123KiB 0.000u 0:00.000
And if I "identify output.png", I get:
Code: Select all
output.png PNG 239x320 239x320+0+0 16-bit DirectClass 200KiB 0.000u 0:00.000
So I'm not sure what's going on here...
Can anyone help me?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Force higher Bit deph of png file
Your first example is 8-bits per channel x 3 channels = 24 bitsroach wrote:I'm having the opposite problem.
The following produces a PNG with 48-bit depth (!).If I "identify input.png", I get:Code: Select all
convert input.png -depth 24 output.png
Which is incorrect, since Photoshop tells me this image is 24-bit, not 8-bit.Code: Select all
input.png PNG 239x320 239x320+0+0 8-bit DirectClass 123KiB 0.000u 0:00.000
And if I "identify output.png", I get:Which is also incorrect, since Photoshop tells me this image is 48-bit, not 16-bit.Code: Select all
output.png PNG 239x320 239x320+0+0 16-bit DirectClass 200KiB 0.000u 0:00.000
So I'm not sure what's going on here...
Can anyone help me?
Your second example is 16-bits per channel x 3 channels = 48 bits
The directclass means per channel. If you had pseudocolor, it would 8 bits total or 16 bits total
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Force higher Bit deph of png file
Fred you are mis-leading people.
-depth in IM does NOT mean image bit depth. It means value bit depth for the output image.
Using -depth 24 should mean 24 bits per color value! However IM rarely can output such a depth so the 'coder' for specific image formats will probably go to some other depth.
-depth in IM does NOT mean image bit depth. It means value bit depth for the output image.
Using -depth 24 should mean 24 bits per color value! However IM rarely can output such a depth so the 'coder' for specific image formats will probably go to some other depth.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/